aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
l---------bin/pconfig1
l---------bin/pmerge1
l---------bin/pquery21
-rwxr-xr-xbin/pwrapper34
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)