aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Sapiro <mark@msapiro.net>2019-08-16 08:18:03 -0700
committerMark Sapiro <mark@msapiro.net>2019-08-16 08:18:03 -0700
commit5312c6f555590fd25bb5c8aa9d2c0db82ccaace8 (patch)
tree8dfbe181cff4caa20870d9325021f72751f3033c
parentaece829521219a7a10ef3c80e0b85e692fa5751c (diff)
downloadmailman2-5312c6f555590fd25bb5c8aa9d2c0db82ccaace8.tar.gz
mailman2-5312c6f555590fd25bb5c8aa9d2c0db82ccaace8.tar.xz
mailman2-5312c6f555590fd25bb5c8aa9d2c0db82ccaace8.zip
Extend sys.path with site.getsitepackages().
-rw-r--r--NEWS3
-rw-r--r--misc/paths.py.in10
2 files changed, 13 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 23622331..c7e7ad30 100644
--- a/NEWS
+++ b/NEWS
@@ -63,6 +63,9 @@ Here is a history of user visible changes to Mailman.
-bounces and -request addresses in each virtual domain are now added
to data/virtual-mailman (-owner was done in 2.1.24). (LP: #1831777)
+ - The paths.py module now extends sys.path with the result of
+ site.getsitepackages() if available. (LP: #1838866)
+
2.1.29 (24-Jul-2018)
Bug Fixes
diff --git a/misc/paths.py.in b/misc/paths.py.in
index 1491639b..e05875e3 100644
--- a/misc/paths.py.in
+++ b/misc/paths.py.in
@@ -67,6 +67,16 @@ distdir = os.path.join(sys.prefix, 'lib', 'python'+sys.version[:3],
'dist-packages')
sys.path.append(distdir)
+# Some distros may have the python library in a directory other than lib/
+# such as Lib/ or lib64/. Hopefully they will have hacked
+# site.getsitepackages() to return the right thing.
+try:
+ import site
+ sys.path.extend(site.getsitepackages())
+ del site
+except (ImportError, AttributeError):
+ pass
+
# In a normal interactive Python environment, the japanese.pth and korean.pth
# files would be imported automatically. But because we inhibit the importing