Skip to content

Commit d1a3a77

Browse files
thorsten-kleinpdgendt
authored andcommitted
fix config file order
Fix order of config files which was added previously in wrong order. Local config must have highest precedence, and system config lowest.
1 parent dca6d0f commit d1a3a77

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/west/configuration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,10 @@ def __init__(self, topdir: PathType | None = None):
185185

186186
def get_paths(self, location: ConfigFile = ConfigFile.ALL) -> list[Path]:
187187
ret = []
188-
if self._global and location in [ConfigFile.GLOBAL, ConfigFile.ALL]:
189-
ret.append(self._global.path)
190188
if self._system and location in [ConfigFile.SYSTEM, ConfigFile.ALL]:
191189
ret.append(self._system.path)
190+
if self._global and location in [ConfigFile.GLOBAL, ConfigFile.ALL]:
191+
ret.append(self._global.path)
192192
if self._local and location in [ConfigFile.LOCAL, ConfigFile.ALL]:
193193
ret.append(self._local.path)
194194
return ret

tests/test_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,16 +139,16 @@ def test_config_list_paths():
139139
assert (
140140
stdout.splitlines()
141141
== textwrap.dedent(f'''\
142-
{WEST_CONFIG_GLOBAL}
143142
{WEST_CONFIG_SYSTEM}
143+
{WEST_CONFIG_GLOBAL}
144144
{WEST_CONFIG_LOCAL}
145145
''').splitlines()
146146
)
147147

148148
# do not list any configs if no config files currently exist
149149
# (Note: even no local config exists, same as outside any west workspace)
150-
pathlib.Path(WEST_CONFIG_GLOBAL).unlink()
151150
pathlib.Path(WEST_CONFIG_SYSTEM).unlink()
151+
pathlib.Path(WEST_CONFIG_GLOBAL).unlink()
152152
pathlib.Path(WEST_CONFIG_LOCAL).unlink()
153153
stdout = cmd('config --list-paths')
154154
assert stdout.splitlines() == []

0 commit comments

Comments
 (0)