[Python-modules-commits] [python-pex] 03/06: Work around Debian's devendorizing of pkg_resource dependencies.
Barry Warsaw
barry at moszumanska.debian.org
Tue Jun 2 19:01:29 UTC 2015
This is an automated email from the git hooks/post-receive script.
barry pushed a commit to branch master
in repository python-pex.
commit 7ac33d1c1f5be417901641525ed7df7142ddf41d
Author: Barry Warsaw <barry at ubuntu.com>
Date: Wed Mar 25 10:48:51 2015 -0400
Work around Debian's devendorizing of pkg_resource dependencies.
Forwarded: not-needed
Patch-Name: handle-pkg_resources-devendorization.patch
---
pex/pex_bootstrapper.py | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/pex/pex_bootstrapper.py b/pex/pex_bootstrapper.py
index 586c788..401b2a7 100644
--- a/pex/pex_bootstrapper.py
+++ b/pex/pex_bootstrapper.py
@@ -95,6 +95,20 @@ def bootstrap_pex(entry_point):
register_finders()
maybe_reexec_pex()
+ # 2015-03-24 BAW (Debian/Ubuntu): This will make grown Pythonistas weep. In
+ # Debian, we devendorize pkg_resources by removing all its bundled
+ # dependencies and making it use the system versions. This plays havoc with
+ # pex though, because pex messes with sys.path and sys.modules and ends up
+ # double importing sub-modules from pkg_resources. This confuses Python
+ # deeply, resulting in AttributeError tracebacks when pkg_resources itself
+ # tries to dig sub-modules out of its own namespace. Yes, AttributeErrors,
+ # not ImportErrors. By pure trial and error, this seems to work around the
+ # problem.
+ import sys
+ for modname in list(sys.modules):
+ if modname.startswith('pkg_resources.'):
+ del sys.modules[modname]
+
from . import pex
pex.PEX(entry_point).execute()
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-pex.git
More information about the Python-modules-commits
mailing list