diff options
l--------- | bin/filter-env | 2 | ||||
l--------- | bin/pclean | 2 | ||||
l--------- | bin/pclonecache | 2 | ||||
l--------- | bin/pconfig | 2 | ||||
l--------- | bin/pebuild | 2 | ||||
l--------- | bin/pinspect | 2 | ||||
l--------- | bin/pmaint | 2 | ||||
l--------- | bin/pmerge | 2 | ||||
l--------- | bin/pplugincache | 2 | ||||
l--------- | bin/pquery | 2 | ||||
-rw-r--r-- | src/pkgcore/const.py | 2 | ||||
-rwxr-xr-x | src/pkgcore/scripts/__init__.py | 11 |
12 files changed, 16 insertions, 17 deletions
diff --git a/bin/filter-env b/bin/filter-env index 3ef8e480d..6b4695d34 120000 --- a/bin/filter-env +++ b/bin/filter-env @@ -1 +1 @@ -../pkgcore/scripts/__init__.py
\ No newline at end of file +../src/pkgcore/scripts/__init__.py
\ No newline at end of file diff --git a/bin/pclean b/bin/pclean index 3ef8e480d..6b4695d34 120000 --- a/bin/pclean +++ b/bin/pclean @@ -1 +1 @@ -../pkgcore/scripts/__init__.py
\ No newline at end of file +../src/pkgcore/scripts/__init__.py
\ No newline at end of file diff --git a/bin/pclonecache b/bin/pclonecache index 3ef8e480d..6b4695d34 120000 --- a/bin/pclonecache +++ b/bin/pclonecache @@ -1 +1 @@ -../pkgcore/scripts/__init__.py
\ No newline at end of file +../src/pkgcore/scripts/__init__.py
\ No newline at end of file diff --git a/bin/pconfig b/bin/pconfig index 3ef8e480d..6b4695d34 120000 --- a/bin/pconfig +++ b/bin/pconfig @@ -1 +1 @@ -../pkgcore/scripts/__init__.py
\ No newline at end of file +../src/pkgcore/scripts/__init__.py
\ No newline at end of file diff --git a/bin/pebuild b/bin/pebuild index 3ef8e480d..6b4695d34 120000 --- a/bin/pebuild +++ b/bin/pebuild @@ -1 +1 @@ -../pkgcore/scripts/__init__.py
\ No newline at end of file +../src/pkgcore/scripts/__init__.py
\ No newline at end of file diff --git a/bin/pinspect b/bin/pinspect index 3ef8e480d..6b4695d34 120000 --- a/bin/pinspect +++ b/bin/pinspect @@ -1 +1 @@ -../pkgcore/scripts/__init__.py
\ No newline at end of file +../src/pkgcore/scripts/__init__.py
\ No newline at end of file diff --git a/bin/pmaint b/bin/pmaint index 3ef8e480d..6b4695d34 120000 --- a/bin/pmaint +++ b/bin/pmaint @@ -1 +1 @@ -../pkgcore/scripts/__init__.py
\ No newline at end of file +../src/pkgcore/scripts/__init__.py
\ No newline at end of file diff --git a/bin/pmerge b/bin/pmerge index 3ef8e480d..6b4695d34 120000 --- a/bin/pmerge +++ b/bin/pmerge @@ -1 +1 @@ -../pkgcore/scripts/__init__.py
\ No newline at end of file +../src/pkgcore/scripts/__init__.py
\ No newline at end of file diff --git a/bin/pplugincache b/bin/pplugincache index 3ef8e480d..6b4695d34 120000 --- a/bin/pplugincache +++ b/bin/pplugincache @@ -1 +1 @@ -../pkgcore/scripts/__init__.py
\ No newline at end of file +../src/pkgcore/scripts/__init__.py
\ No newline at end of file diff --git a/bin/pquery b/bin/pquery index 3ef8e480d..6b4695d34 120000 --- a/bin/pquery +++ b/bin/pquery @@ -1 +1 @@ -../pkgcore/scripts/__init__.py
\ No newline at end of file +../src/pkgcore/scripts/__init__.py
\ No newline at end of file diff --git a/src/pkgcore/const.py b/src/pkgcore/const.py index 6a7d16644..10358018c 100644 --- a/src/pkgcore/const.py +++ b/src/pkgcore/const.py @@ -43,7 +43,7 @@ def _GET_CONST(attr, default_value, allow_environment_override=False): return result -_reporoot = osp.dirname(osp.dirname(osp.realpath(__file__))) +_reporoot = osp.realpath(__file__).rsplit(os.path.sep, 3)[0] DATA_PATH = _GET_CONST('DATA_PATH', _reporoot, allow_environment_override=True) LIBDIR_PATH = _GET_CONST('LIBDIR_PATH', _reporoot) CONFIG_PATH = _GET_CONST('CONFIG_PATH', '%(DATA_PATH)s/config') diff --git a/src/pkgcore/scripts/__init__.py b/src/pkgcore/scripts/__init__.py index 35e3efe95..b66d66c1b 100755 --- a/src/pkgcore/scripts/__init__.py +++ b/src/pkgcore/scripts/__init__.py @@ -21,7 +21,7 @@ def run(script_name): 'Verify that pkgcore and its deps are properly installed ' 'and/or PYTHONPATH is set correctly for python %s.\n' % ('.'.join(map(str, sys.version_info[:3])),)) - if '--debug' in sys.argv: + if '--debug' in sys.argv[1:]: raise sys.stderr.write('Add --debug to the commandline for a traceback.\n') sys.exit(1) @@ -32,9 +32,8 @@ def run(script_name): if __name__ == '__main__': - # we're in a git repo or tarball so add the base dir to the system path - repo_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - if not os.path.exists(os.path.join(repo_dir, 'setup.py')): - raise SystemExit('unknown repo hierarchy, %r should be repo root' % repo_dir) - sys.path.insert(0, repo_dir) + # We're in a git repo or tarball so add the src dir to the system path. + # Note that this assumes a certain module layout. + src_dir = os.path.realpath(__file__).rsplit(os.path.sep, 3)[0] + sys.path.insert(0, src_dir) run(os.path.basename(__file__)) |