aboutsummaryrefslogtreecommitdiffstats
path: root/tools/misc/xen-python-path
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-04-08 19:13:04 +0100
committerKeir Fraser <keir.fraser@citrix.com>2009-04-08 19:13:04 +0100
commit11e1149fe08e2e9a478696cc1c3b331e6b8e4efa (patch)
tree9843ac399a374fe6638c4898444d838899d0742e /tools/misc/xen-python-path
parente4eff651ee91d38bd9c37312ca606652f8496af5 (diff)
downloadxen-11e1149fe08e2e9a478696cc1c3b331e6b8e4efa.tar.gz
xen-11e1149fe08e2e9a478696cc1c3b331e6b8e4efa.tar.bz2
xen-11e1149fe08e2e9a478696cc1c3b331e6b8e4efa.zip
tools: Always use sane upstream (`native') python paths
Previously, by default we would install our python modules into /usr/lib/python/xen, for example /usr/lib/python/xen/__init__.py. Upstream python's standard install location (a) includes the Python version number and (b) puts things in site-packages by default. Our best conjecture for the reason for this was an attempt to make the installs portable between different python versions. However, that doesn't work because compiled python modules (.pyc), and C python extensions corresponding to one version of python, are not compatible across different versions of python. This is why upstream include the version number. site-packages is the standard location for locally-installed packages and is automatically included on the python search path. In this change, we abandon our own unusual python path setup: * Invoke setup.py in an entirely standard manner. We pass PREFIX and DESTDIR using the appropriate options provided by setup.py for those purposes (adding them to setup.py calls which were previously lacking them). * Since the installation locations are now on the standard python path, we no longer need to add anything to the path in any of our python utilities. Therefore remove all that code from every python script. (Many of these scripts unconditionally added /usr/lib/python and /usr/lib64/python which is wrong even in the old world.) * There is no longer any special `Xen python path'. xen-python-path is no longer needed. It is no longer called by anything in our tree. However since out-of-tree callers may still invoke it, we retain it. It now prints a fixed string referring to a directory which does not to exist; callers (who use it to augment their python path) will thus add a nonexistent directory to their python path which is harmless. * Remove various workarounds including use of setup.py --home (which is intended for something completely different). * Remove tests for the XEN_PYTHON_NATIVE_INSTALL build-time environment variable. The new behaviour is the behaviour which we should have had if this variable had been set. That is, it is now as if this variable was always set but also bugs in the resulting install have been fixed. This should be a proper fix for the bug addressed by c/s 19515. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/misc/xen-python-path')
-rw-r--r--tools/misc/xen-python-path31
1 files changed, 4 insertions, 27 deletions
diff --git a/tools/misc/xen-python-path b/tools/misc/xen-python-path
index 57774a332b..073abaef53 100644
--- a/tools/misc/xen-python-path
+++ b/tools/misc/xen-python-path
@@ -17,31 +17,8 @@
# Copyright (C) 2007 XenSource Inc.
#============================================================================
+# Nowadays we install xen in the standard python site-packages
+# directories. This script is still provided for the benefit of old
+# out-of-xen-tree callers. It is deprecated and will be removed.
-# 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)
+print '/dev/enoent/xen/python-path'