summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorbwarsaw2002-02-23 06:30:01 +0000
committerbwarsaw2002-02-23 06:30:01 +0000
commite8b23454cbb0a6ec1d2167c1c92b43218cf20feb (patch)
tree77057d59fcc69593c3821cd36f9692fd85fe47ba /misc
parent5b0e24f97303fe931e86a0e5b87204071033fad5 (diff)
downloadmailman-e8b23454cbb0a6ec1d2167c1c92b43218cf20feb.tar.gz
mailman-e8b23454cbb0a6ec1d2167c1c92b43218cf20feb.tar.zst
mailman-e8b23454cbb0a6ec1d2167c1c92b43218cf20feb.zip
Some new path-hacking code:
- Stick $prefix/pythonlib on the front of sys.path. I've gone back and forth about this for a long time; the question is: for modules that Mailman provides which override the ones in the Python standard library, should they explicitly import our overrides or implicitly import them due to sys.path hacking? I used to want the former, but now I want the latter because it makes code maintenance easier (we don't have to modify a bunch of files when we add or get rid of a shadow module). Yes, this violates explicit over implicit, but I think it's for a good cause. I may regret this some day <wink>. - Go back to appending site-packages to sys.path instead of prepending it. This makes it semantically more similar to the hacking that goes on in site.py. We also don't need for site-packages to be earlier in the path because of the above new rules for shadowing. Remember that we start up the CGI scripts with python -S, so we still need to get site-packages on sys.path (probably).
Diffstat (limited to 'misc')
-rw-r--r--misc/paths.py.in13
1 files changed, 7 insertions, 6 deletions
diff --git a/misc/paths.py.in b/misc/paths.py.in
index f774558d1..b42d0d361 100644
--- a/misc/paths.py.in
+++ b/misc/paths.py.in
@@ -38,11 +38,12 @@ if exec_prefix == '${prefix}':
# directory.
sys.path.insert(0, prefix)
-# Include Python's site-packages directory. We need this even for Python 2.2
-# since the email package has some patches not included in 2.2 final (though
-# likely included in a 2.2 patch release, not available as of this writing
-# 29-Jan-2002). That's why we prepend sitedir to sys.path, not append it.
-import sys
+# We also need the pythonlib directory on the path to pick up any overrides of
+# standard modules and packages. Note that these must go at the front of the
+# path for this reason.
+sys.path.insert(0, os.path.join(prefix, 'pythonlib'))
+
+# Include Python's site-packages directory.
sitedir = os.path.join(sys.prefix, 'lib', 'python'+sys.version[:3],
'site-packages')
-sys.path.insert(0, sitedir)
+sys.path.append(sitedir)