Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lestarch: making settings.ini settings platform-overridable #59

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/fprime/fbuild/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,9 @@ def __setup_default(self, platform: str = None, build_dir: Path = None):
self.platform = self.settings.get("default_ut_toolchain", "native")
else:
self.platform = self.settings.get("default_toolchain", "native")

self.settings.update(
IniSettings.load(self.deployment / "settings.ini", self.platform)
)
self.build_dir = build_dir if build_dir is not None else self.get_build_cache()


Expand Down
13 changes: 7 additions & 6 deletions src/fprime/fbuild/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,13 @@ def read_safe_path(
return expanded

@staticmethod
def load(settings_file: Path):
def load(settings_file: Path, platform: str = "fprime"):
"""
Load settings from specified file or from specified build directory. Either a specific file or the build
directory must be not None.

:param settings_file: file to load settings from (in INI format). Must be specified if build_dir is not.
:param platform: platform to read platform specific settings
:return: a dictionary of needed settings
"""
settings_file = (
Expand Down Expand Up @@ -102,17 +103,17 @@ def load(settings_file: Path):
proj_root = None if not proj_root else proj_root[0]
# Read ac constants if it is available
ac_consts = IniSettings.read_safe_path(
confparse, "fprime", "ac_constants", settings_file
confparse, platform, "ac_constants", settings_file
)
ac_consts = None if not ac_consts else ac_consts[0]
# Read include constants if it is available
config_dir = IniSettings.read_safe_path(
confparse, "fprime", "config_directory", settings_file
confparse, platform, "config_directory", settings_file
)
config_dir = None if not config_dir else config_dir[0]

install_dest = IniSettings.read_safe_path(
confparse, "fprime", "install_dest", settings_file, False
confparse, platform, "install_dest", settings_file, False
)

if install_dest:
Expand All @@ -122,11 +123,11 @@ def load(settings_file: Path):

# Read separate environment file if necessary
env_file = IniSettings.read_safe_path(
confparse, "fprime", "environment_file", settings_file
confparse, platform, "environment_file", settings_file
)
env_file = settings_file if not env_file else env_file[0]
libraries = IniSettings.read_safe_path(
confparse, "fprime", "library_locations", settings_file
confparse, platform, "library_locations", settings_file
)
environment = IniSettings.load_environment(env_file)

Expand Down