From 8de57f3af10c4c1abf94b07968890d9ec452e1cf Mon Sep 17 00:00:00 2001 From: "Sode, Adedamola (DLSLtd,RAL,LSCI)" Date: Wed, 29 Apr 2026 13:21:41 +0000 Subject: [PATCH 1/4] Added conditions for branched services --- src/techui_builder/builder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/techui_builder/builder.py b/src/techui_builder/builder.py index 3ad5c592..5790c480 100644 --- a/src/techui_builder/builder.py +++ b/src/techui_builder/builder.py @@ -105,7 +105,7 @@ def clean_files(self): logger_.info("Preserving edited screens for validation.") logger_.debug(f"Screens to validate: {list(self.validator.validate.keys())}") - logger_.info("Cleaning synoptic/ of generated screens.") + logger_.info("Cleaning synoptic directory of generated screens.") try: # Find the JsonMap file From eacac3d907c98c5d9f042e930bb5a129b13d5757 Mon Sep 17 00:00:00 2001 From: "Sode, Adedamola (DLSLtd,RAL,LSCI)" Date: Wed, 29 Apr 2026 14:31:11 +0000 Subject: [PATCH 2/4] modified test_find_dirs --- tests/test_cli.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_cli.py b/tests/test_cli.py index fd8ee0df..a068df78 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -62,14 +62,16 @@ def test_find_dirs(caplog): mock_services.relative_to.return_value = Path("mock_rel_path") mock_parent = MagicMock(spec=Path) mock_parent.glob.return_value = [mock_services] - mock_absolute = MagicMock() + mock_absolute = MagicMock(spec=Path) mock_absolute.parents = [mock_parent] + mock_absolute.parent = mock_parent mock_path = MagicMock(spec=Path) mock_path.absolute.return_value = mock_absolute services, synoptic = find_dirs(mock_path, "ixx") - assert synoptic == Path("mock_rel_path/synoptic") + assert synoptic == mock_absolute.parent + assert services == Path("mock_rel_path") def test_find_dirs_no_ixx_services_dir(caplog): From b5d705b6bd85a227f19b807a6a69e154c39b2c79 Mon Sep 17 00:00:00 2001 From: "Sode, Adedamola (DLSLtd,RAL,LSCI)" Date: Thu, 28 May 2026 10:32:35 +0000 Subject: [PATCH 3/4] Adding test for jxx --- tests/test_cli.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/test_cli.py b/tests/test_cli.py index a068df78..4192438b 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -88,6 +88,25 @@ def test_find_dirs_no_ixx_services_dir(caplog): assert exc_info.value.code is None +def test_find_dirs_jxx_services(caplog): + mock_services = MagicMock(spec=Path) + mock_services.relative_to.return_value = Path("mock_rel_path") + mock_parent = MagicMock(spec=Path) + mock_parent.glob.return_value = [mock_services] + mock_absolute = MagicMock(spec=Path) + mock_absolute.parents = [mock_parent] + mock_absolute.parent = mock_parent + mock_path = MagicMock(spec=Path) + mock_path.absolute.return_value = mock_absolute + + with caplog.at_level(logging.INFO): + services, synoptic = find_dirs(mock_path, "jxx") + + assert synoptic == mock_absolute.parent + assert services == Path("mock_rel_path") + assert "jxx-services not found. Searching for Ixx-services..." in caplog.text + + def test_find_bob(caplog): bob_file = Mock(spec=Path) bob_file.exists = MagicMock(return_value=True) From 742fec63839dcacaa3d748a65d36f9e7ec3da2c5 Mon Sep 17 00:00:00 2001 From: "Sode, Adedamola (DLSLtd,RAL,LSCI)" Date: Tue, 2 Jun 2026 08:23:34 +0000 Subject: [PATCH 4/4] rebased changes for multiple beamlines --- src/techui_builder/main_app.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/techui_builder/main_app.py b/src/techui_builder/main_app.py index 738d084d..aae1fab5 100644 --- a/src/techui_builder/main_app.py +++ b/src/techui_builder/main_app.py @@ -25,22 +25,34 @@ def find_dirs(file_path: Path, beamline: str) -> tuple: cwd = Path.cwd() logger_.debug(f"Working directory: {cwd}") + directory = beamline + + if not beamline.startswith("i"): + # If not found, try searching for Ixx-services as some + # J/K beamlines are in Ixx-services dir + directory = f"i{beamline[1:]}" + logger_.info( + f"{beamline}-services not found. Searching for I{beamline[1:]}-services..." + ) # Get the relative path of ixx-services to techui.yaml ixx_services_dir = next( ( ixx_services.relative_to(cwd, walk_up=True) for parent in abs_path.parents - for ixx_services in parent.glob(f"{beamline}-services") + for ixx_services in parent.glob(f"{directory}-services") ), None, ) + if ixx_services_dir is None: - logging.critical("ixx-services not found. Is you file structure correct?") + logging.critical( + f"{beamline}-services not found. Is you file structure correct?" + ) exit() logger_.debug(f"ixx-services relative path: {ixx_services_dir}") # Get the synoptic dir relative to the parent dir - synoptic_dir = ixx_services_dir.joinpath("synoptic") + synoptic_dir = abs_path.parent logger_.debug(f"synoptic relative path: {synoptic_dir}") return ixx_services_dir, synoptic_dir