diff --git a/MANIFEST.in b/MANIFEST.in index 6039e28da7..1cd3faf252 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -8,4 +8,5 @@ include tests/utils.py include run_tests.py include glance/registry/db/migrate_repo/migrate.cfg graft doc +graft etc graft tools diff --git a/bin/glance-api b/bin/glance-api index 91a2297ac2..eb05674f68 100755 --- a/bin/glance-api +++ b/bin/glance-api @@ -26,9 +26,13 @@ import optparse import os import sys -ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - -sys.path.append(ROOT_DIR) +# If ../glance/__init__.py exists, add ../ to Python search path, so that +# it will override what happens to be installed in /usr/(local/)lib/python... +possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), + os.pardir, + os.pardir)) +if os.path.exists(os.path.join(possible_topdir, 'glance', '__init__.py')): + sys.path.insert(0, possible_topdir) from glance import version from glance.common import config diff --git a/bin/glance-combined b/bin/glance-combined index 7b8372f87a..9b9b90f144 100755 --- a/bin/glance-combined +++ b/bin/glance-combined @@ -28,9 +28,13 @@ import optparse import os import sys -ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - -sys.path.append(ROOT_DIR) +# If ../glance/__init__.py exists, add ../ to Python search path, so that +# it will override what happens to be installed in /usr/(local/)lib/python... +possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), + os.pardir, + os.pardir)) +if os.path.exists(os.path.join(possible_topdir, 'glance', '__init__.py')): + sys.path.insert(0, possible_topdir) from glance import version from glance.common import config diff --git a/bin/glance-control b/bin/glance-control index 1912c3ad2f..b0100d24f0 100755 --- a/bin/glance-control +++ b/bin/glance-control @@ -31,9 +31,13 @@ import signal import sys import time -ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - -sys.path.append(ROOT_DIR) +# If ../glance/__init__.py exists, add ../ to Python search path, so that +# it will override what happens to be installed in /usr/(local/)lib/python... +possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), + os.pardir, + os.pardir)) +if os.path.exists(os.path.join(possible_topdir, 'glance', '__init__.py')): + sys.path.insert(0, possible_topdir) from glance import version from glance.common import config diff --git a/bin/glance-manage b/bin/glance-manage index 91a07b1754..1bbe3a01e6 100755 --- a/bin/glance-manage +++ b/bin/glance-manage @@ -30,9 +30,13 @@ import optparse import os import sys -ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - -sys.path.append(ROOT_DIR) +# If ../glance/__init__.py exists, add ../ to Python search path, so that +# it will override what happens to be installed in /usr/(local/)lib/python... +possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), + os.pardir, + os.pardir)) +if os.path.exists(os.path.join(possible_topdir, 'glance', '__init__.py')): + sys.path.insert(0, possible_topdir) from glance import version as glance_version from glance.common import config diff --git a/bin/glance-registry b/bin/glance-registry index 330065861f..1e9d56dbd6 100755 --- a/bin/glance-registry +++ b/bin/glance-registry @@ -26,9 +26,13 @@ import optparse import os import sys -ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - -sys.path.append(ROOT_DIR) +# If ../glance/__init__.py exists, add ../ to Python search path, so that +# it will override what happens to be installed in /usr/(local/)lib/python... +possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), + os.pardir, + os.pardir)) +if os.path.exists(os.path.join(possible_topdir, 'glance', '__init__.py')): + sys.path.insert(0, possible_topdir) from glance import version from glance.common import config