From 8450a7f951b112d22167019e09ce64153f416ce2 Mon Sep 17 00:00:00 2001 From: Giles Knap Date: Fri, 13 Oct 2023 10:01:55 +0000 Subject: [PATCH 1/5] remove python.defaultInterpreterPath setting --- .devcontainer/devcontainer.json | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 44de8d36a..5a12f276f 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -19,10 +19,6 @@ "upgradePackages": false } }, - // Set *default* container specific settings.json values on container create. - "settings": { - "python.defaultInterpreterPath": "/venv/bin/python" - }, "customizations": { "vscode": { // Add the IDs of extensions you want installed when the container is created. @@ -51,4 +47,4 @@ "workspaceFolder": "${localWorkspaceFolder}", // After the container is created, install the python project in editable form "postCreateCommand": "pip install -e '.[dev]'" -} +} \ No newline at end of file From a9bd8252fc0610e129c20a878c3aafeb018eb061 Mon Sep 17 00:00:00 2001 From: Giles Knap Date: Tue, 17 Oct 2023 05:42:56 +0000 Subject: [PATCH 2/5] fix make_switcher bad skeleton merge --- .github/pages/make_switcher.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/pages/make_switcher.py b/.github/pages/make_switcher.py index 6728a5bf7..d70367aec 100755 --- a/.github/pages/make_switcher.py +++ b/.github/pages/make_switcher.py @@ -43,9 +43,9 @@ def get_versions(ref: str, add: Optional[str], remove: Optional[str]) -> List[st # Get a sorted list of tags tags = get_sorted_tags_list() - # Make the sorted versions list from change_linter_to_ruff branches and tags + # Make the sorted versions list from main branches and tags versions: List[str] = [] - for version in ["master", "change_linter_to_ruff"] + tags: + for version in ["master", "main"] + tags: if version in builds: versions.append(version) builds.remove(version) @@ -67,7 +67,7 @@ def write_json(path: Path, repository: str, versions: str): path.write_text(text, encoding="utf-8") -def change_linter_to_ruff(args=None): +def main(args=None): parser = ArgumentParser( description="Make a versions.txt file from gh-pages directories" ) @@ -95,5 +95,5 @@ def change_linter_to_ruff(args=None): write_json(args.output, args.repository, versions) -if __name__ == "__change_linter_to_ruff__": - change_linter_to_ruff() +if __name__ == "__main__": + main() From ea9da7e1cfe88f2a300ad236f820221837dd9dcf Mon Sep 17 00:00:00 2001 From: Giles Knap Date: Wed, 25 Oct 2023 21:23:05 +0100 Subject: [PATCH 3/5] add pause to end of default start.sh --- src/ibek/templates/ioc/config/start.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ibek/templates/ioc/config/start.sh b/src/ibek/templates/ioc/config/start.sh index 8961f3b4d..a10e6dbaa 100644 --- a/src/ibek/templates/ioc/config/start.sh +++ b/src/ibek/templates/ioc/config/start.sh @@ -34,6 +34,10 @@ Choices of contents of the config folder are: - send a reboot command to the RTEMS crate - start a telnet session to the RTEMS IOC console +' - -' \ No newline at end of file +# This is a placeholder script, but we still need keep the container running. +# Wait indefinitely so the container does not exit and restart continually. +while true; do + sleep 1 +done From f7d82deb08596c5a7761eeba70f11ee123a1f5da Mon Sep 17 00:00:00 2001 From: Giles Knap Date: Mon, 30 Oct 2023 09:25:00 +0000 Subject: [PATCH 4/5] move ibek yaml files to /epics/ibek --- docs/conf.py | 1 + src/ibek/globals.py | 3 +-- src/ibek/ioc_cmds/assets.py | 4 ++-- src/ibek/support_cmds/commands.py | 4 ++-- src/ibek/templates/ioc/start.sh | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index a4ceae7ed..15f352566 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -154,6 +154,7 @@ logo=dict( text=project, ), + navigation_with_keys=True, use_edit_page_button=True, github_url=f"https://github.com/{github_user}/{github_repo}", icon_links=[ diff --git a/src/ibek/globals.py b/src/ibek/globals.py index a9c4b279f..080d63c9b 100644 --- a/src/ibek/globals.py +++ b/src/ibek/globals.py @@ -27,8 +27,7 @@ # Folder containing templates for IOC src etc. TEMPLATES = Path(__file__).parent / "templates" -# Folder containing symlinks to useful files -SYMLINKS = EPICS_ROOT / "links" +IBEK_FILES = EPICS_ROOT / "ibek" IOC_DBDS = SUPPORT / "configure/dbd_list" IOC_LIBS = SUPPORT / "configure/lib_list" diff --git a/src/ibek/ioc_cmds/assets.py b/src/ibek/ioc_cmds/assets.py index 36226c28b..b76d8117f 100644 --- a/src/ibek/ioc_cmds/assets.py +++ b/src/ibek/ioc_cmds/assets.py @@ -6,7 +6,7 @@ import typer -from ibek.globals import EPICS_ROOT, IOC_FOLDER, SYMLINKS +from ibek.globals import EPICS_ROOT, IBEK_FILES, IOC_FOLDER def get_ioc_source() -> Path: @@ -69,7 +69,7 @@ def extract_assets(destination: Path, source: Path, extras: List[Path], defaults default_assets = [ get_ioc_source() / "ibek-support", source / "support" / "configure", - SYMLINKS, + IBEK_FILES, IOC_FOLDER, Path("/venv"), ] diff --git a/src/ibek/support_cmds/commands.py b/src/ibek/support_cmds/commands.py index 2dda101d0..ec3d059af 100644 --- a/src/ibek/support_cmds/commands.py +++ b/src/ibek/support_cmds/commands.py @@ -17,12 +17,12 @@ from typing_extensions import Annotated from ibek.globals import ( + IBEK_FILES, IOC_DBDS, IOC_LIBS, RELEASE, RUNTIME_DEBS, SUPPORT, - SYMLINKS, NaturalOrderGroup, ) from ibek.support import Support @@ -256,7 +256,7 @@ def generate_links( support_yaml = from_path.glob("*/*.ibek.support.yaml") - to_path = SYMLINKS / "ibek" + to_path = IBEK_FILES to_path.mkdir(parents=True, exist_ok=True) for yaml in support_yaml: link_from = to_path / yaml.name diff --git a/src/ibek/templates/ioc/start.sh b/src/ibek/templates/ioc/start.sh index a9981ecef..8fcbcfc60 100755 --- a/src/ibek/templates/ioc/start.sh +++ b/src/ibek/templates/ioc/start.sh @@ -74,7 +74,7 @@ if [ -f ${ibek_src} ]; then final_ioc_startup=/tmp/st.cmd # get ibek the support yaml files this ioc's support modules - defs=/epics/links/ibek/*.ibek.support.yaml + defs=/epics/ibek/*.ibek.support.yaml ibek runtime generate ${ibek_src} ${defs} --out ${final_ioc_startup} --db-out ${db_src} # build expanded database using msi From 5a1ee025a5138484bb7d046399568fa26e07609a Mon Sep 17 00:00:00 2001 From: Giles Knap Date: Mon, 30 Oct 2023 11:37:49 +0000 Subject: [PATCH 5/5] fix naming of subst files --- src/ibek/gen_scripts.py | 2 +- src/ibek/runtime_cmds/commands.py | 2 +- .../{db.subst.jinja => ioc.subst.jinja} | 0 src/ibek/templates/ioc/start.sh | 8 +++---- tests/generate_samples.sh | 6 ++--- tests/samples/outputs/all.ioc.subst | 23 +++++++++++++++++++ tests/samples/outputs/objects.ioc.subst | 10 ++++++++ tests/samples/outputs/utils.ioc.subst | 3 +++ tests/test_cli.py | 12 +++++----- 9 files changed, 51 insertions(+), 15 deletions(-) rename src/ibek/templates/{db.subst.jinja => ioc.subst.jinja} (100%) create mode 100644 tests/samples/outputs/all.ioc.subst create mode 100644 tests/samples/outputs/objects.ioc.subst create mode 100644 tests/samples/outputs/utils.ioc.subst diff --git a/src/ibek/gen_scripts.py b/src/ibek/gen_scripts.py index 21698bb0f..06fc6ff87 100644 --- a/src/ibek/gen_scripts.py +++ b/src/ibek/gen_scripts.py @@ -66,7 +66,7 @@ def create_db_script(ioc_instance: IOC) -> str: """ Create make_db.sh script for expanding the database templates """ - with open(TEMPLATES / "db.subst.jinja", "r") as f: + with open(TEMPLATES / "ioc.subst.jinja", "r") as f: jinja_txt = f.read() renderer = RenderDb(ioc_instance) diff --git a/src/ibek/runtime_cmds/commands.py b/src/ibek/runtime_cmds/commands.py index babaa824d..d5549d519 100644 --- a/src/ibek/runtime_cmds/commands.py +++ b/src/ibek/runtime_cmds/commands.py @@ -26,7 +26,7 @@ def generate( help="Path to output startup script", ), db_out: Path = typer.Option( - default="config/db.subst", + default="config/ioc.subst", help="Path to output database expansion shell script", ), ): diff --git a/src/ibek/templates/db.subst.jinja b/src/ibek/templates/ioc.subst.jinja similarity index 100% rename from src/ibek/templates/db.subst.jinja rename to src/ibek/templates/ioc.subst.jinja diff --git a/src/ibek/templates/ioc/start.sh b/src/ibek/templates/ioc/start.sh index 8fcbcfc60..3090ee240 100755 --- a/src/ibek/templates/ioc/start.sh +++ b/src/ibek/templates/ioc/start.sh @@ -83,13 +83,13 @@ if [ -f ${ibek_src} ]; then bash -c "msi -o${epics_db} ${includes} -S${db_src}" fi -# 2. st.cmd + ioc.substitutions ************************************************ +# 2. st.cmd + ioc.subst ************************************************ elif [ -f ${ioc_startup} ] ; then - if [ -f ${CONFIG_DIR}/ioc.substitutions ]; then - # generate ioc.db from ioc.substitutions, including all templates from SUPPORT + if [ -f ${CONFIG_DIR}/ioc.subst ]; then + # generate ioc.db from ioc.subst, including all templates from SUPPORT includes=$(for i in ${SUPPORT}/*/db; do echo -n "-I $i "; done) - msi ${includes} -S ${CONFIG_DIR}/ioc.substitutions -o ${epics_db} + msi ${includes} -S ${CONFIG_DIR}/ioc.subst -o ${epics_db} fi final_ioc_startup=${ioc_startup} diff --git a/tests/generate_samples.sh b/tests/generate_samples.sh index 725346162..ff6fbe889 100755 --- a/tests/generate_samples.sh +++ b/tests/generate_samples.sh @@ -29,10 +29,10 @@ echo making an ioc schema using multiple support yaml files ibek ioc generate-schema yaml/objects.ibek.support.yaml yaml/all.ibek.support.yaml --output schemas/multiple.ibek.ioc.schema.json echo making ioc based on objects support yaml -ibek runtime generate yaml/objects.ibek.ioc.yaml yaml/objects.ibek.support.yaml --out outputs/objects.st.cmd --db-out outputs/objects.db.subst +ibek runtime generate yaml/objects.ibek.ioc.yaml yaml/objects.ibek.support.yaml --out outputs/objects.st.cmd --db-out outputs/objects.ioc.subst echo making ioc based on utils support yaml -ibek runtime generate yaml/utils.ibek.ioc.yaml yaml/utils.ibek.support.yaml --out outputs/utils.st.cmd --db-out outputs/utils.db.subst +ibek runtime generate yaml/utils.ibek.ioc.yaml yaml/utils.ibek.support.yaml --out outputs/utils.st.cmd --db-out outputs/utils.ioc.subst echo making ioc based on mutiple support yaml -ibek runtime generate yaml/all.ibek.ioc.yaml yaml/objects.ibek.support.yaml yaml/all.ibek.support.yaml --out outputs/all.st.cmd --db-out outputs/all.db.subst +ibek runtime generate yaml/all.ibek.ioc.yaml yaml/objects.ibek.support.yaml yaml/all.ibek.support.yaml --out outputs/all.st.cmd --db-out outputs/all.ioc.subst diff --git a/tests/samples/outputs/all.ioc.subst b/tests/samples/outputs/all.ioc.subst new file mode 100644 index 000000000..808a99c20 --- /dev/null +++ b/tests/samples/outputs/all.ioc.subst @@ -0,0 +1,23 @@ +############################################################################# +# DB substitution file generated by http://github.com/epics-containers/ibek # +############################################################################# + +file "another_test.db" { +pattern + { "name", "my_int_enum", "clock_rate", "db_calculated", "calculated_one" } + { "AllObject One", "2", "dummy", "HELLO AllObject One", "AllObject One.AllObject One String.1.1.0.True" } + { "AllObject Two", "1", "1", "HELLO AllObject Two", "AllObject Two.AllObject Two String.1.1.0.True" } +} + +file "yet_another.db" { +pattern + { "name", "my_object", "my_float", "my_bool" } + { "AllObject One", "Ref1", "1.0", "True" } + { "AllObject Two", "Ref1", "1.0", "True" } +} + +file "test.db" { +pattern + { "name", "ip", "value" } + { "Consumer Two With DB", "127.0.0.1", "Ref1.127.0.0.1" } +} diff --git a/tests/samples/outputs/objects.ioc.subst b/tests/samples/outputs/objects.ioc.subst new file mode 100644 index 000000000..6f74bf7aa --- /dev/null +++ b/tests/samples/outputs/objects.ioc.subst @@ -0,0 +1,10 @@ +############################################################################# +# DB substitution file generated by http://github.com/epics-containers/ibek # +############################################################################# + +file "test.db" { +pattern + { "name", "ip", "value" } + { "Consumer of another port", "10.0.0.2", "AsynPort2.10.0.0.2" } + { "Another Consumer of the 2nd port", "10.0.0.2", "AsynPort2.10.0.0.2" } +} diff --git a/tests/samples/outputs/utils.ioc.subst b/tests/samples/outputs/utils.ioc.subst new file mode 100644 index 000000000..535e1a86b --- /dev/null +++ b/tests/samples/outputs/utils.ioc.subst @@ -0,0 +1,3 @@ +############################################################################# +# DB substitution file generated by http://github.com/epics-containers/ibek # +############################################################################# diff --git a/tests/test_cli.py b/tests/test_cli.py index 2106d6cc5..90e237440 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -75,7 +75,7 @@ def test_build_runtime_single(tmp_path: Path, samples: Path): ioc_yaml = samples / "yaml" / "objects.ibek.ioc.yaml" support_yaml = samples / "yaml" / "objects.ibek.support.yaml" out_file = tmp_path / "new_dir" / "st.cmd" - out_db = tmp_path / "new_dir" / "objects.db.subst" + out_db = tmp_path / "new_dir" / "objects.ioc.subst" run_cli( "runtime", @@ -92,7 +92,7 @@ def test_build_runtime_single(tmp_path: Path, samples: Path): actual_boot = out_file.read_text() assert example_boot == actual_boot - example_db = (samples / "outputs" / "objects.db.subst").read_text() + example_db = (samples / "outputs" / "objects.ioc.subst").read_text() actual_db = out_db.read_text() assert example_db == actual_db @@ -110,7 +110,7 @@ def test_build_runtime_multiple(tmp_path: Path, samples: Path): support_yaml = samples / "yaml" / "objects.ibek.support.yaml" support_yaml2 = samples / "yaml" / "all.ibek.support.yaml" out_file = tmp_path / "st.cmd" - out_db = tmp_path / "all.db.subst" + out_db = tmp_path / "all.ioc.subst" run_cli( "runtime", @@ -128,7 +128,7 @@ def test_build_runtime_multiple(tmp_path: Path, samples: Path): actual_boot = out_file.read_text() assert example_boot == actual_boot - example_db = (samples / "outputs" / "all.db.subst").read_text() + example_db = (samples / "outputs" / "all.ioc.subst").read_text() actual_db = out_db.read_text() assert example_db == actual_db @@ -141,7 +141,7 @@ def test_build_utils_features(tmp_path: Path, samples: Path): ioc_yaml = samples / "yaml" / "utils.ibek.ioc.yaml" support_yaml = samples / "yaml" / "utils.ibek.support.yaml" out_file = tmp_path / "st.cmd" - out_db = tmp_path / "db.subst" + out_db = tmp_path / "ioc.subst" run_cli( "runtime", @@ -158,6 +158,6 @@ def test_build_utils_features(tmp_path: Path, samples: Path): actual_boot = out_file.read_text() assert example_boot == actual_boot - example_db = (samples / "outputs" / "utils.db.subst").read_text() + example_db = (samples / "outputs" / "utils.ioc.subst").read_text() actual_db = out_db.read_text() assert example_db == actual_db