From e8b23454cbb0a6ec1d2167c1c92b43218cf20feb Mon Sep 17 00:00:00 2001 From: bwarsaw Date: Sat, 23 Feb 2002 06:30:01 +0000 Subject: 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 . - 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). --- misc/paths.py.in | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'misc/paths.py.in') 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) -- cgit v1.2.3-70-g09d2