diff --git a/easybuild/tools/options.py b/easybuild/tools/options.py index 8a95aa7226..4249963eda 100644 --- a/easybuild/tools/options.py +++ b/easybuild/tools/options.py @@ -123,7 +123,7 @@ def terminal_supports_colors(stream): CONFIG_ENV_VAR_PREFIX = 'EASYBUILD' XDG_CONFIG_HOME = os.environ.get('XDG_CONFIG_HOME', os.path.join(os.path.expanduser('~'), ".config")) -XDG_CONFIG_DIRS = os.environ.get('XDG_CONFIG_DIRS', '/etc/xdg').split(os.pathsep) +XDG_CONFIG_DIRS = os.environ.get('XDG_CONFIG_DIRS', '/etc/xdg').split(os.pathsep)[::-1] DEFAULT_SYS_CFGFILES = [f for d in XDG_CONFIG_DIRS for f in sorted(glob.glob(os.path.join(d, 'easybuild.d', '*.cfg')))] DEFAULT_USER_CFGFILE = os.path.join(XDG_CONFIG_HOME, 'easybuild', 'config.cfg') diff --git a/test/framework/config.py b/test/framework/config.py index 337c7b9b87..08a1a83355 100644 --- a/test/framework/config.py +++ b/test/framework/config.py @@ -448,7 +448,7 @@ def test_XDG_CONFIG_env_vars(self): # $XDG_CONFIG_HOME not set, multiple directories listed in $XDG_CONFIG_DIRS del os.environ['XDG_CONFIG_HOME'] # unset, so should become default - os.environ['XDG_CONFIG_DIRS'] = os.pathsep.join([dir1, dir2, dir3]) + os.environ['XDG_CONFIG_DIRS'] = os.pathsep.join([dir3, dir2, dir1]) cfg_files = [ os.path.join(dir1, 'easybuild.d', 'bar.cfg'), os.path.join(dir1, 'easybuild.d', 'foo.cfg'), diff --git a/test/framework/options.py b/test/framework/options.py index d30fa7b390..2daa053915 100644 --- a/test/framework/options.py +++ b/test/framework/options.py @@ -3542,7 +3542,7 @@ def test_show_default_configfiles(self): xdg_config_home = os.path.join(self.test_prefix, 'home') os.environ['XDG_CONFIG_HOME'] = xdg_config_home - xdg_config_dirs = [os.path.join(self.test_prefix, 'etc', 'xdg'), os.path.join(self.test_prefix, 'moaretc')] + xdg_config_dirs = [os.path.join(self.test_prefix, 'moaretc'), os.path.join(self.test_prefix, 'etc', 'xdg')] os.environ['XDG_CONFIG_DIRS'] = os.pathsep.join(xdg_config_dirs) # put various dummy cfgfiles in place @@ -3563,7 +3563,7 @@ def test_show_default_configfiles(self): logtxt = read_file(self.logfile) expected = expected_tmpl % (xdg_config_home, os.pathsep.join(xdg_config_dirs), "%s => found" % os.path.join(xdg_config_home, 'easybuild', 'config.cfg'), - '{' + ', '.join(xdg_config_dirs) + '}', + '{' + ', '.join(xdg_config_dirs[::-1]) + '}', ', '.join(cfgfiles[:-1]), 4, ', '.join(cfgfiles)) self.assertIn(expected, logtxt)