source: trunk/packages/xen-3.1/xen-3.1/tools/misc/xen-python-path @ 34

Last change on this file since 34 was 34, checked in by hartmans, 18 years ago

Add xen and xen-common

  • Property svn:mime-type set to text/script
File size: 1.6 KB
Line 
1#!/usr/bin/env python
2#  -*- mode: python; -*-
3#============================================================================
4# This library is free software; you can redistribute it and/or
5# modify it under the terms of version 2.1 of the GNU Lesser General Public
6# License as published by the Free Software Foundation.
7#
8# This library is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11# Lesser General Public License for more details.
12#
13# You should have received a copy of the GNU Lesser General Public
14# License along with this library; if not, write to the Free Software
15# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16#============================================================================
17# Copyright (C) 2007 XenSource Inc.
18#============================================================================
19
20
21# Use the auxbin module in Xend to determine the correct Python path.  We
22# take the first installed instance of auxbin that we find, and then run it
23# to determine the correct path, appending that to sys.path.
24
25AUXBIN = 'xen/util/auxbin.py'
26
27import os
28import os.path
29import sys
30
31for p in ['python%s' % sys.version[:3], 'python']:
32    for l in ['/usr/lib64', '/usr/lib']:
33        d = os.path.join(l, p)
34        if os.path.exists(os.path.join(d, AUXBIN)):
35            sys.path.append(d)
36            import xen.util.auxbin
37            print os.path.join(xen.util.auxbin.libpath(), p)
38            sys.exit(0)
39
40print >>sys.stderr, "Cannot find Xen Python modules."
41sys.exit(1)
Note: See TracBrowser for help on using the repository browser.