| Line | |
|---|
| 1 | #!/usr/bin/env python |
|---|
| 2 | |
|---|
| 3 | """Wrapper script that messes with sys.path and runs scripts. |
|---|
| 4 | |
|---|
| 5 | This should only be run from inside the "bin" subdir of a pkgcore |
|---|
| 6 | checkout or unpacked tarball. It adds the parent of that "bin" dir to |
|---|
| 7 | sys.path unconditionally. |
|---|
| 8 | """ |
|---|
| 9 | |
|---|
| 10 | import os.path as osp |
|---|
| 11 | import sys |
|---|
| 12 | |
|---|
| 13 | sys.path.insert(0, osp.dirname(osp.dirname(osp.abspath(__file__)))) |
|---|
| 14 | |
|---|
| 15 | from pkgcore.util import modules, commandline |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | if __name__ == '__main__': |
|---|
| 19 | name = osp.basename(sys.argv[0]) |
|---|
| 20 | script = modules.load_module('pkgcore.scripts.%s' % (name,)) |
|---|
| 21 | subcommands = getattr(script, 'commandline_commands', None) |
|---|
| 22 | if subcommands is None: |
|---|
| 23 | subcommands = {None: (script.OptionParser, script.main)} |
|---|
| 24 | commandline.main(subcommands) |
|---|