mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
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>
48 lines
1.8 KiB
Python
48 lines
1.8 KiB
Python
#!/usr/bin/env python
|
|
# -*- mode: python; -*-
|
|
#============================================================================
|
|
# This library is free software; you can redistribute it and/or
|
|
# modify it under the terms of version 2.1 of the GNU Lesser General Public
|
|
# License as published by the Free Software Foundation.
|
|
#
|
|
# This library is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
# Lesser General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
# License along with this library; if not, write to the Free Software
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
#============================================================================
|
|
# Copyright (C) 2007 XenSource Inc.
|
|
#============================================================================
|
|
|
|
|
|
# Use the auxbin module in Xend to determine the correct Python path. We
|
|
# take the first installed instance of auxbin that we find, and then run it
|
|
# to determine the correct path, appending that to sys.path.
|
|
|
|
AUXBIN = 'xen/util/auxbin.py'
|
|
|
|
import os
|
|
import os.path
|
|
import sys
|
|
|
|
usr = os.path.dirname(os.path.dirname(sys.argv[0]))
|
|
list = [ os.path.join(usr,'lib64') ]
|
|
list += [ os.path.join(usr,'lib') ]
|
|
list += ['/usr/lib64', '/usr/lib']
|
|
|
|
for l in list:
|
|
for p in ['python%s' % sys.version[:3], 'python']:
|
|
for k in ['', 'site-packages/']:
|
|
d = os.path.join(l, p, k)
|
|
if os.path.exists(os.path.join(d, AUXBIN)):
|
|
sys.path.append(d)
|
|
import xen.util.auxbin
|
|
print os.path.join(xen.util.auxbin.libpath(), p)
|
|
sys.exit(0)
|
|
|
|
print >>sys.stderr, "Cannot find Xen Python modules."
|
|
sys.exit(1)
|