diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2001-01-11 13:02:43 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2001-01-11 13:02:43 (GMT) |
commit | bb0a4b7898437988b1b022f0170a2052926479c7 (patch) | |
tree | 2ff967f5662f2ec20e15fa8408c7faf047be7d47 | |
parent | f5df3834eb83dc388f332a8e0b115bd4bef97728 (diff) | |
download | cpython-bb0a4b7898437988b1b022f0170a2052926479c7.zip cpython-bb0a4b7898437988b1b022f0170a2052926479c7.tar.gz cpython-bb0a4b7898437988b1b022f0170a2052926479c7.tar.bz2 |
Patch #103134: Support import lines in pth files.
-rw-r--r-- | Lib/site.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/site.py b/Lib/site.py index 512f00b..3f4e830 100644 --- a/Lib/site.py +++ b/Lib/site.py @@ -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) |