]> granicus.if.org Git - python/commitdiff
Fix a problem in site.py which triggers in case sys.path is empty.
authorMarc-André Lemburg <mal@egenix.com>
Thu, 19 Sep 2002 11:11:27 +0000 (11:11 +0000)
committerMarc-André Lemburg <mal@egenix.com>
Thu, 19 Sep 2002 11:11:27 +0000 (11:11 +0000)
Bugfix candidate for 2.2.2.

Lib/site.py

index a6ffb59d8373e820457c2c8f2348af3a30553172..0d1ea395ea28d21cfd7da70be4f007ffa872a762 100644 (file)
@@ -94,7 +94,8 @@ del dir, dircase, L
 # (especially for Guido :-)
 # XXX This should not be part of site.py, since it is needed even when
 # using the -S option for Python.  See http://www.python.org/sf/586680
-if os.name == "posix" and os.path.basename(sys.path[-1]) == "Modules":
+if (os.name == "posix" and sys.path 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)