Commit 8c471e06 authored by Barry Warsaw's avatar Barry Warsaw

Fix issue #3 by searching for the 'master' script in several possible

locations.
parent 63a9cb13
......@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment