diff options
| author | Barry Warsaw | 2015-05-16 02:35:57 +0000 |
|---|---|---|
| committer | Barry Warsaw | 2015-05-16 02:35:57 +0000 |
| commit | b675a65e9bea0a43e7a0c945a0112c57cc5bffaf (patch) | |
| tree | 00b9a4ff341f20cba1a7456a3ec0d93d5897be38 /src | |
| parent | da76d9ebae8562a683fc7161af227546fbbc42b8 (diff) | |
| parent | e0e97073d97c345ba0fbd0b38925d57c61e01763 (diff) | |
| download | mailman-b675a65e9bea0a43e7a0c945a0112c57cc5bffaf.tar.gz mailman-b675a65e9bea0a43e7a0c945a0112c57cc5bffaf.tar.zst mailman-b675a65e9bea0a43e7a0c945a0112c57cc5bffaf.zip | |
Diffstat (limited to 'src')
| -rw-r--r-- | src/mailman/config/config.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/mailman/config/config.py b/src/mailman/config/config.py index d23bdda13..e9da7ae4f 100644 --- a/src/mailman/config/config.py +++ b/src/mailman/config/config.py @@ -134,8 +134,20 @@ class Configuration: def _expand_paths(self): """Expand all configuration paths.""" - # Set up directories. - bin_dir = os.path.abspath(os.path.dirname(sys.executable)) + # First we need to locate the bin directory. This can differ in + # several cases, such as, if we're installing into a virtual + # environment, /usr/bin, /usr/local/bin, or running the test suite. + # We'll try some common locations, looking for a landmark. First + # location wins. + for origin in (sys.executable, sys.argv[0]): + bin_dir = os.path.abspath(os.path.dirname(origin)) + # Search for 'master' in this directory, since that's the thing we + # actually need to be able to run. + if os.path.exists(os.path.join(bin_dir, 'master')): + break + else: + print("Could not find the 'master' script", file=sys.stderr) + sys.exit(1) # Now that we've loaded all the configuration files we're going to # load, set up some useful directories based on the settings in the # configuration file. |
