summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2001-01-19 21:54:59 (GMT)
committerGuido van Rossum <guido@python.org>2001-01-19 21:54:59 (GMT)
commit48eb9cd62fefcf8cc93416512f15c913f55331bd (patch)
tree6ac6fae7b7d2070b06ebb1d67bd81c4491502b39 /Lib
parent2cfa9806c7b4e21e44f00593ccbaeded703382de (diff)
downloadcpython-48eb9cd62fefcf8cc93416512f15c913f55331bd.zip
cpython-48eb9cd62fefcf8cc93416512f15c913f55331bd.tar.gz
cpython-48eb9cd62fefcf8cc93416512f15c913f55331bd.tar.bz2
A hack to augment sys.path with the build/lib.<platform> directory
created by Andrew's setup.py script, *if* we're actually running from the build directory. (The test for that: whether the sys.path[-1] ends in "/Modules".) This has one disadvantage: it imports a fair amount of code from the distutils package, just in order to be able to calculate the correct pathname. See if I care. :-)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/site.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/site.py b/Lib/site.py
index 3f4e830..12fe71d 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -79,6 +79,15 @@ for dir in sys.path:
sys.path[:] = L
del dir, L
+# Append ./build/lib.<platform> in case we're running in the build dir
+# (especially for Guido :-)
+if os.name == "posix" and os.path.basename(sys.path[-1]) == "Modules":
+ from distutils.util import get_platform
+ s = "build/lib.%s-%.3s" % (get_platform(), sys.version)
+ s = os.path.join(os.path.dirname(sys.path[-1]), s)
+ sys.path.append(s)
+ del get_platform, s
+
def addsitedir(sitedir):
sitedir = makepath(sitedir)
if sitedir not in sys.path: