[Python-modules-commits] [python-pex] 08/10: Work around Debian's devendorizing of pkg_resource dependencies.
Barry Warsaw
barry at moszumanska.debian.org
Tue Mar 22 17:19:18 UTC 2016
This is an automated email from the git hooks/post-receive script.
barry pushed a commit to branch master
in repository python-pex.
commit 1c903a85e39cd3fa74bd4159e72c1dbee2024cdd
Author: Barry Warsaw <barry at debian.org>
Date: Thu Aug 13 18:21:53 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 137757f..f2aaa45 100644
--- a/pex/pex_bootstrapper.py
+++ b/pex/pex_bootstrapper.py
@@ -94,6 +94,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