diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/pwrapper | 6 | ||||
-rwxr-xr-x | bin/pwrapper_installed | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/bin/pwrapper b/bin/pwrapper index 1917467b..c7532e8d 100755 --- a/bin/pwrapper +++ b/bin/pwrapper @@ -7,6 +7,7 @@ checkout or unpacked tarball. It adds the parent of that "bin" dir to sys.path unconditionally. """ +from importlib import import_module import os import os.path as osp import sys @@ -15,7 +16,6 @@ sys.path.insert(1, osp.dirname(osp.dirname(osp.abspath(__file__)))) if __name__ == '__main__': try: - from snakeoil import modules from pkgcore.util import commandline except ImportError: sys.stderr.write('Cannot import either snakeoil or pkgcore!\n') @@ -30,8 +30,8 @@ if __name__ == '__main__': os.environ["PKGCORE_SCRIPT_PATH"] = osp.dirname(osp.abspath(__file__)) name = osp.basename(sys.argv[0]).replace("-", "_") try: - script = modules.load_module('pkgcore.scripts.%s' % (name,)) - except modules.FailedImport: + script = import_module('pkgcore.scripts.%s' % (name,)) + except ImportError: sys.stderr.write('Cannot load script %s.\n' % (name,)) if '--debug' in sys.argv: raise diff --git a/bin/pwrapper_installed b/bin/pwrapper_installed index 5056e1fc..89318c3a 100755 --- a/bin/pwrapper_installed +++ b/bin/pwrapper_installed @@ -2,12 +2,12 @@ """Wrapper script that runs a pkgcore script from sys.path.""" +from importlib import import_module import os.path as osp import sys if __name__ == '__main__': try: - from snakeoil import modules from pkgcore.util import commandline except ImportError: sys.stderr.write('Cannot import either snakeoil or pkgcore!\n') @@ -21,8 +21,8 @@ if __name__ == '__main__': name = osp.basename(sys.argv[0]).replace("-", "_") try: - script = modules.load_module('pkgcore.scripts.%s' % (name,)) - except modules.FailedImport: + script = import_module('pkgcore.scripts.%s' % (name,)) + except ImportError: sys.stderr.write('Cannot load script %s.\n' % (name,)) if '--debug' in sys.argv: raise |