direct-io.hg

changeset 15405:7825043607bc

tools: Adjust tools' path calculation.

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 <jbeulich@novell.com>
author kfraser@localhost.localdomain
date Wed Jun 20 17:07:15 2007 +0100 (2007-06-20)
parents f50f0ec7dd2c
children 296fd2598e00
files tools/misc/xen-python-path tools/python/xen/util/auxbin.py
line diff
     1.1 --- a/tools/misc/xen-python-path	Wed Jun 20 17:05:48 2007 +0100
     1.2 +++ b/tools/misc/xen-python-path	Wed Jun 20 17:07:15 2007 +0100
     1.3 @@ -28,8 +28,13 @@ import os
     1.4  import os.path
     1.5  import sys
     1.6  
     1.7 -for p in ['python%s' % sys.version[:3], 'python']:
     1.8 -    for l in ['/usr/lib64', '/usr/lib']:
     1.9 +usr   = os.path.dirname(os.path.dirname(sys.argv[0]))
    1.10 +list  = [ os.path.join(usr,'lib64') ]
    1.11 +list += [ os.path.join(usr,'lib') ]
    1.12 +list += ['/usr/lib64', '/usr/lib']
    1.13 +
    1.14 +for l in list:
    1.15 +    for p in ['python%s' % sys.version[:3], 'python']:
    1.16          for k in ['', 'site-packages/']:
    1.17              d = os.path.join(l, p, k)
    1.18              if os.path.exists(os.path.join(d, AUXBIN)):
     2.1 --- a/tools/python/xen/util/auxbin.py	Wed Jun 20 17:05:48 2007 +0100
     2.2 +++ b/tools/python/xen/util/auxbin.py	Wed Jun 20 17:07:15 2007 +0100
     2.3 @@ -27,6 +27,7 @@ LIB_64_ARCHS = [ 'x86_64', 's390x', 'spa
     2.4  
     2.5  import os
     2.6  import os.path
     2.7 +import sys
     2.8  
     2.9  
    2.10  def execute(exe, args = None):
    2.11 @@ -47,6 +48,14 @@ def path():
    2.12  
    2.13  def libpath():
    2.14      machine = os.uname()[4]
    2.15 +    if sys.argv[0] != '-c':
    2.16 +        prefix = os.path.dirname(os.path.dirname(sys.argv[0]))
    2.17 +        path = os.path.join(prefix, os.path.basename(LIB_64))
    2.18 +        if machine in LIB_64_ARCHS and os.path.exists(path):
    2.19 +            return path
    2.20 +        path = os.path.join(prefix, os.path.basename(LIB_32))
    2.21 +        if os.path.exists(path):
    2.22 +            return path
    2.23      if machine in LIB_64_ARCHS and os.path.exists(LIB_64):
    2.24          return LIB_64
    2.25      else: