diff --git a/src/fprime/fbuild/builder.py b/src/fprime/fbuild/builder.py index 050bf736..051a9e5d 100644 --- a/src/fprime/fbuild/builder.py +++ b/src/fprime/fbuild/builder.py @@ -302,8 +302,8 @@ def get_cmake_args(self) -> dict: ("FPRIME_SETTINGS_FILE", "settings_file"), ("FPRIME_ENVIRONMENT_FILE", "environment_file"), ("FPRIME_AC_CONSTANTS_FILE", "ac_constants"), - ("FPRIME_CONFIG_DIR", "config_dir"), - ("FPRIME_INSTALL_DEST", "install_dest"), + ("FPRIME_CONFIG_DIR", "config_directory"), + ("FPRIME_INSTALL_DEST", "install_destination"), ] cmake_args = { cache: self.get_settings(setting, None) @@ -402,13 +402,17 @@ def purge(self): def purge_install(self): """Purge the install directory""" - assert "install_dest" in self.settings, "install_dest not present in settings" - self.cmake.purge(self.settings["install_dest"]) + assert ( + "install_destination" in self.settings + ), "install_destination not present in settings" + self.cmake.purge(self.settings["install_destination"]) def install_dest_exists(self) -> Path: """Check if the install destination exists and returns the path if it does""" - assert "install_dest" in self.settings, "install_dest not present in settings" - path = Path(self.settings["install_dest"]) + assert ( + "install_destination" in self.settings + ), "install_destination not present in settings" + path = Path(self.settings["install_destination"]) return path if path.exists() else None @staticmethod diff --git a/src/fprime/fbuild/settings.py b/src/fprime/fbuild/settings.py index 3a93f658..d07f3ba1 100644 --- a/src/fprime/fbuild/settings.py +++ b/src/fprime/fbuild/settings.py @@ -58,14 +58,18 @@ class IniSettings: ] PLATFORM_FIELDS = [ - ("config_dir", SettingType.PATH, partial(join, "framework_path", "config")), + ( + "config_directory", + SettingType.PATH, + partial(join, "framework_path", "config"), + ), ( "ac_constants", SettingType.PATH, - partial(join, "config_dir", "AcConstants.ini"), + partial(join, "config_directory", "AcConstants.ini"), ), ( - "install_dest", + "install_destination", SettingType.PATH, partial(join, "_deployment", "build-artifacts"), ), @@ -89,8 +93,10 @@ def read_safe_path( separated by ':'. This will also expand relative paths relative to the settings file. :param parser: parser to read from + :param section: section to read from :param key: key to read from :param ini_file: ini_file path for clean errors + :param exists: expect the path to exist. Default: True, must exist. :return: path, validated """ base_dir = os.path.dirname(ini_file) @@ -129,7 +135,7 @@ def read_setting( section, key, settings["settings_file"], - key != "install_dest", + key != "install_destination", ) value = paths_list[0] if paths_list else get_default_value() elif settings_type == SettingType.PATH_LIST: @@ -138,7 +144,7 @@ def read_setting( section, key, settings["settings_file"], - key != "install_dest", + key != "install_destination", ) value = paths_list or get_default_value() else: diff --git a/test/fprime/fbuild/settings-data/settings-custom-install.ini b/test/fprime/fbuild/settings-data/settings-custom-install.ini index 40bb60a6..c3137ca8 100644 --- a/test/fprime/fbuild/settings-data/settings-custom-install.ini +++ b/test/fprime/fbuild/settings-data/settings-custom-install.ini @@ -1,3 +1,3 @@ [fprime] -install_dest: ../test +install_destination: ../test framework_path: ../.. diff --git a/test/fprime/fbuild/test_settings.py b/test/fprime/fbuild/test_settings.py index e770d8b2..3ee49499 100644 --- a/test/fprime/fbuild/test_settings.py +++ b/test/fprime/fbuild/test_settings.py @@ -31,14 +31,14 @@ def test_settings(): "default_toolchain": "native", "default_ut_toolchain": "native", "framework_path": full_path(".."), - "install_dest": full_path("settings-data/build-artifacts"), + "install_destination": full_path("settings-data/build-artifacts"), "library_locations": [], "environment_file": full_path("settings-data/settings-empty.ini"), "environment": {}, "component_cookiecutter": "default", "ac_constants": full_path("..") / "config" / "AcConstants.ini", "project_root": full_path(".."), - "config_dir": full_path("..") / "config", + "config_directory": full_path("..") / "config", }, }, { @@ -48,7 +48,7 @@ def test_settings(): "default_toolchain": "native", "default_ut_toolchain": "native", "framework_path": full_path(".."), - "install_dest": full_path("test"), + "install_destination": full_path("test"), "library_locations": [], "environment_file": full_path( "settings-data/settings-custom-install.ini" @@ -57,7 +57,7 @@ def test_settings(): "component_cookiecutter": "default", "ac_constants": full_path("..") / "config" / "AcConstants.ini", "project_root": full_path(".."), - "config_dir": full_path("..") / "config", + "config_directory": full_path("..") / "config", }, }, { @@ -69,7 +69,7 @@ def test_settings(): "default_toolchain": "custom1", "default_ut_toolchain": "custom2", "framework_path": full_path(".."), - "install_dest": full_path("settings-data/build-artifacts"), + "install_destination": full_path("settings-data/build-artifacts"), "library_locations": [], "environment_file": full_path( "settings-data/settings-custom-toolchain.ini" @@ -78,7 +78,7 @@ def test_settings(): "component_cookiecutter": "default", "ac_constants": full_path("..") / "config" / "AcConstants.ini", "project_root": full_path(".."), - "config_dir": full_path("..") / "config", + "config_directory": full_path("..") / "config", }, }, { @@ -90,7 +90,7 @@ def test_settings(): "default_toolchain": "native", "default_ut_toolchain": "native", "framework_path": full_path(".."), - "install_dest": full_path("settings-data/build-artifacts"), + "install_destination": full_path("settings-data/build-artifacts"), "library_locations": [], "environment_file": full_path( "settings-data/settings-outside-cookiecutter.ini" @@ -99,7 +99,7 @@ def test_settings(): "component_cookiecutter": "gh:SterlingPeet/cookiecutter-fprime-deployment", "ac_constants": full_path("..") / "config" / "AcConstants.ini", "project_root": full_path(".."), - "config_dir": full_path("..") / "config", + "config_directory": full_path("..") / "config", }, }, ]