From: "Jan Beulich" Subject: [PATCH] adjust tools' path calculation Date: Tue, 19 Jun 2007 11:37:30 +0100 Message-ID: <4677CE0A.76E4.0078.0@novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org In the hope that it will be acceptable, I'm suggesting this change to make another tiny step towards the ability to run the tools e.g. out of the build tree (so that multiple different Xen versions can co-exist without the requirement to re-install the respective version with each boot). Signed-off-by: Jan Beulich Index: 2007-06-18/tools/misc/xen-python-path =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 2007-06-18.orig/tools/misc/xen-python-path 2007-06-19 11:25:18.0000000= 00 +0200 +++ 2007-06-18/tools/misc/xen-python-path 2007-06-18 12:15:35.0000000= 00 +0200 @@ -28,8 +28,13 @@ import os import os.path import sys =20 -for p in ['python%s' % sys.version[:3], 'python']: - for l in ['/usr/lib64', '/usr/lib']: +usr =3D os.path.dirname(os.path.dirname(sys.argv[0])) +list =3D [ os.path.join(usr,'lib64') ] +list +=3D [ os.path.join(usr,'lib') ] +list +=3D ['/usr/lib64', '/usr/lib'] + +for l in list: + for p in ['python%s' % sys.version[:3], 'python']: for k in ['', 'site-packages/']: d =3D os.path.join(l, p, k) if os.path.exists(os.path.join(d, AUXBIN)): Index: 2007-06-18/tools/python/xen/util/auxbin.py =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 2007-06-18.orig/tools/python/xen/util/auxbin.py 2007-06-19 = 11:25:18.000000000 +0200 +++ 2007-06-18/tools/python/xen/util/auxbin.py 2007-06-18 12:15:35.0000000= 00 +0200 @@ -27,6 +27,7 @@ LIB_64_ARCHS =3D [ 'x86_64', 's390x', 'spa =20 import os import os.path +import sys =20 =20 def execute(exe, args =3D None): @@ -47,6 +48,14 @@ def path(): =20 def libpath(): machine =3D os.uname()[4] + if sys.argv[0] !=3D '-c': + prefix =3D os.path.dirname(os.path.dirname(sys.argv[0])) + path =3D os.path.join(prefix, os.path.basename(LIB_64)) + if machine in LIB_64_ARCHS and os.path.exists(path): + return path + path =3D os.path.join(prefix, os.path.basename(LIB_32)) + if os.path.exists(path): + return path if machine in LIB_64_ARCHS and os.path.exists(LIB_64): return LIB_64 else: