summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorThomas Heller <theller@ctypes.org>2002-11-14 18:45:11 (GMT)
committerThomas Heller <theller@ctypes.org>2002-11-14 18:45:11 (GMT)
commitc7aaf953faf3f4f22c8a77209927dcacfba91490 (patch)
tree453cba3b5d02f58bd4b5f15f488453ca05702353 /Tools
parentc293704e93adfe45961bcf8456a2c244970c443e (diff)
downloadcpython-c7aaf953faf3f4f22c8a77209927dcacfba91490.zip
cpython-c7aaf953faf3f4f22c8a77209927dcacfba91490.tar.gz
cpython-c7aaf953faf3f4f22c8a77209927dcacfba91490.tar.bz2
Enhancement for ModuleFinder, it can now handle _xmlplus aka PyXML.
Fixes SF # 637835.
Diffstat (limited to 'Tools')
-rw-r--r--Tools/freeze/modulefinder.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Tools/freeze/modulefinder.py b/Tools/freeze/modulefinder.py
index 96fc2f7..5886e7b 100644
--- a/Tools/freeze/modulefinder.py
+++ b/Tools/freeze/modulefinder.py
@@ -29,6 +29,17 @@ def AddPackagePath(packagename, path):
paths.append(path)
packagePathMap[packagename] = paths
+replacePackageMap = {}
+
+# This ReplacePackage mechanism allows modulefinder to work around the
+# way the _xmlplus package injects itself under the name "xml" into
+# sys.modules at runtime by calling ReplacePackage("_xmlplus", "xml")
+# before running ModuleFinder.
+
+def ReplacePackage(oldname, newname):
+ replacePackageMap[oldname] = newname
+
+
class Module:
def __init__(self, name, file=None, path=None):
@@ -336,6 +347,9 @@ class ModuleFinder:
def load_package(self, fqname, pathname):
self.msgin(2, "load_package", fqname, pathname)
+ newname = replacePackageMap.get(fqname)
+ if newname:
+ fqname = newname
m = self.add_module(fqname)
m.__file__ = pathname
m.__path__ = [pathname]