diff options
author | Tristan van Berkom <tristan.vanberkom@codethink.co.uk> | 2020-05-29 18:50:53 +0900 |
---|---|---|
committer | Tristan van Berkom <tristan.vanberkom@codethink.co.uk> | 2020-05-29 18:50:53 +0900 |
commit | 5890fb7826f749f76c0d1fffcdd517724997df57 (patch) | |
tree | d6e1f6676344cce4288871daca7e843201c5b53d | |
parent | e252b637df82986b099be812456f0f5d44165b8c (diff) | |
download | buildstream-5890fb7826f749f76c0d1fffcdd517724997df57.tar.gz |
_context.py: Support parallel installations of BuildStream
Allow users to keep separate buildstream.conf files in their
XDG_CONFIG_HOME for separate BuildStream versions, in case they
have BuildStream 1 and 2 installed.
-rw-r--r-- | buildstream/_context.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/buildstream/_context.py b/buildstream/_context.py index 8a7cec70c..f36bfd343 100644 --- a/buildstream/_context.py +++ b/buildstream/_context.py @@ -147,10 +147,15 @@ class Context(): # a $XDG_CONFIG_HOME/buildstream.conf file # if not config: - default_config = os.path.join(os.environ['XDG_CONFIG_HOME'], - 'buildstream.conf') - if os.path.exists(default_config): - config = default_config + # + # Support parallel installations of BuildStream by first + # trying buildstream1.conf and then falling back to buildstream.conf. + # + for config_filename in ("buildstream1.conf", "buildstream.conf"): + default_config = os.path.join(os.environ["XDG_CONFIG_HOME"], config_filename) + if os.path.exists(default_config): + config = default_config + break # Load default config # |