diff options
author | Thomas Heller <theller@ctypes.org> | 2003-11-14 10:28:42 (GMT) |
---|---|---|
committer | Thomas Heller <theller@ctypes.org> | 2003-11-14 10:28:42 (GMT) |
commit | aaf1c8dc9e6a3c83b974ebea4b2e3929526689c3 (patch) | |
tree | 1d3d0333126cfd3e2967bff98628dd478f6f832e | |
parent | 780c497972f367df86cf0f6f3b7c2aecf1e078d6 (diff) | |
download | cpython-aaf1c8dc9e6a3c83b974ebea4b2e3929526689c3.zip cpython-aaf1c8dc9e6a3c83b974ebea4b2e3929526689c3.tar.gz cpython-aaf1c8dc9e6a3c83b974ebea4b2e3929526689c3.tar.bz2 |
SF #841977 - modulefinder fails to find extension modules in packages
The find_all_submodules() method in modulefinder only
looks for *.py, *.pyc, and *.pyo files. Python
extension modules are only found if they are referenced
in import statements somewhere.
This patch uses the actual list from imp.get_suffixes().
Backported myself.
-rw-r--r-- | Lib/modulefinder.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/modulefinder.py b/Lib/modulefinder.py index be59f97..6dec0e5 100644 --- a/Lib/modulefinder.py +++ b/Lib/modulefinder.py @@ -210,7 +210,12 @@ class ModuleFinder: if not m.__path__: return modules = {} - suffixes = [".py", ".pyc", ".pyo"] + # 'suffixes' used to be a list hardcoded to [".py", ".pyc", ".pyo"]. + # But we must also collect Python extension modules - although + # we cannot separate normal dlls from Python extensions. + suffixes = [] + for triple in imp.get_suffixes(): + suffixes.append(triple[0]) for dir in m.__path__: try: names = os.listdir(dir) |