diff options
author | 2006-09-15 22:42:03 -0700 | |
---|---|---|
committer | 2006-09-15 22:42:03 -0700 | |
commit | 959476949690cb5b5e3785e96cef770f5eff2cb0 (patch) | |
tree | ba909c0dcfe3463a38ff57d838c652c9288942c8 /bin | |
parent | make extension tests explicitly skipped instead of silently dropped if the ex... (diff) | |
download | pkgcore-959476949690cb5b5e3785e96cef770f5eff2cb0.tar.gz pkgcore-959476949690cb5b5e3785e96cef770f5eff2cb0.tar.bz2 pkgcore-959476949690cb5b5e3785e96cef770f5eff2cb0.zip |
merge up from marienz; mainly script changes.
Diffstat (limited to 'bin')
l--------- | bin/pconfig | 1 | ||||
l--------- | bin/pmerge | 1 | ||||
l--------- | bin/pquery2 | 1 | ||||
-rwxr-xr-x | bin/pwrapper | 34 |
4 files changed, 37 insertions, 0 deletions
diff --git a/bin/pconfig b/bin/pconfig new file mode 120000 index 00000000..42dd5d8d --- /dev/null +++ b/bin/pconfig @@ -0,0 +1 @@ +pwrapper
\ No newline at end of file diff --git a/bin/pmerge b/bin/pmerge new file mode 120000 index 00000000..42dd5d8d --- /dev/null +++ b/bin/pmerge @@ -0,0 +1 @@ +pwrapper
\ No newline at end of file diff --git a/bin/pquery2 b/bin/pquery2 new file mode 120000 index 00000000..42dd5d8d --- /dev/null +++ b/bin/pquery2 @@ -0,0 +1 @@ +pwrapper
\ No newline at end of file diff --git a/bin/pwrapper b/bin/pwrapper new file mode 100755 index 00000000..e38b9da5 --- /dev/null +++ b/bin/pwrapper @@ -0,0 +1,34 @@ +#!/usr/bin/env python + +"""Wrapper script that messes with sys.path and runs scripts. + +If it sees a ../pkgcore/__init__.py relative to its absolute location +it adds .. to sys.path. It then imports and runs pkgcore.scripts.<sys.argv[0]>. +""" + +import os.path as osp +import sys + +try: + from pkgcore.util import modules, commandline +except ImportError: + print >> sys.stderr, 'Cannot import pkgcore!' + print >> sys.stderr, 'Verify it is properly installed and/or ' \ + 'PYTHONPATH is set correctly.' + print >> sys.stderr, 'Add --debug to the commandline for a traceback.' + if '--debug' in sys.argv: + raise + sys.exit(1) + +if __name__ == '__main__': + name = osp.basename(sys.argv[0]) + try: + script = modules.load_module('pkgcore.scripts.%s' % (name,)) + except modules.FailedImport: + print >> sys.stderr, 'Cannot load script %s.' % (name,) + print >> sys.stderr, 'Add --debug to the commandline for a traceback.' + if '--debug' in sys.argv: + raise + sys.exit(1) + else: + commandline.main(script.OptionParser(), script.main) |