]> granicus.if.org Git - python/commitdiff
Patch #103134: Support import lines in pth files.
authorMartin v. Löwis <martin@v.loewis.de>
Thu, 11 Jan 2001 13:02:43 +0000 (13:02 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Thu, 11 Jan 2001 13:02:43 +0000 (13:02 +0000)
Lib/site.py

index 512f00b3b60e269aac9fda06ea66af985e02146c..3f4e8304c00317417295ba7d0d9b920ec906273d 100644 (file)
@@ -23,7 +23,7 @@ A path configuration file is a file whose name has the form
 to be added to sys.path.  Non-existing directories (or
 non-directories) are never added to sys.path; no directory is added to
 sys.path more than once.  Blank lines and lines beginning with
-\code{#} are skipped.
+\code{#} are skipped. Lines starting with \code{import} are executed.
 
 For example, suppose sys.prefix and sys.exec_prefix are set to
 /usr/local and there is a directory /usr/local/lib/python1.5/site-packages
@@ -105,6 +105,9 @@ def addpackage(sitedir, name):
             break
         if dir[0] == '#':
             continue
+        if dir.startswith("import"):
+            exec dir
+            continue
         if dir[-1] == '\n':
             dir = dir[:-1]
         dir = makepath(sitedir, dir)