[Pkg-xen-changes] [xen] 29/128: tools-python-prefix.diff
Ian Campbell
ijc-guest at moszumanska.debian.org
Sat Jul 12 09:06:08 UTC 2014
This is an automated email from the git hooks/post-receive script.
ijc-guest pushed a commit to branch feature/4.4-updates
in repository xen.
commit 8694cab781c57fd1a2a0625008b7a71c3946e7be
Author: Bastian Blank <waldi at debian.org>
Date: Sat Jul 5 11:47:02 2014 +0200
tools-python-prefix.diff
---
tools/python/xen/util/auxbin.py | 36 +++++++++++++++++++-----------------
1 file changed, 19 insertions(+), 17 deletions(-)
diff --git a/tools/python/xen/util/auxbin.py b/tools/python/xen/util/auxbin.py
index a690ad9..b1bd191 100644
--- a/tools/python/xen/util/auxbin.py
+++ b/tools/python/xen/util/auxbin.py
@@ -19,29 +19,31 @@
import os
import os.path
import sys
-from xen.util.path import *
+import xen.util.path
+
+
+class _Path(object):
+ def __init__(self, path=[]):
+ self._path = path
+ def __call__(self, name):
+ for dir in self._path:
+ real = os.path.join(dir, name)
+ if os.path.exists(real):
+ return real
+
+
+path_bin = _Path([xen.util.path.PRIVATE_BINDIR, '/usr/lib/xen/bin', '/usr/sbin', '/sbin', '/usr/bin', '/bin'])
+path_boot = _Path([xen.util.path.XENFIRMWAREDIR, '/usr/lib/xen/boot', '/boot'])
def execute(exe, args = None):
- exepath = pathTo(exe)
+ exepath = path_bin(exe)
a = [ exepath ]
if args:
a.extend(args)
- try:
- os.execv(exepath, a)
- except (OSError, TypeError), exn:
- print exepath, ": ", exn
- sys.exit(1)
-
-SEARCHDIRS = [ BINDIR, SBINDIR, LIBEXEC, PRIVATE_BINDIR, XENFIRMWAREDIR ]
-def pathTo(exebin):
- for dir in SEARCHDIRS:
- exe = os.path.join(dir, exebin)
- if os.path.exists(exe):
- return exe
- return None
+ os.execv(exepath, a)
def xen_configdir():
- return XEN_CONFIG_DIR
+ return xen.util.path.XEN_CONFIG_DIR
def scripts_dir():
- return XEN_SCRIPT_DIR
+ return xen.util.path.XEN_SCRIPT_DIR
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-xen/xen.git
More information about the Pkg-xen-changes
mailing list