Skip to content
Snippets Groups Projects
Commit 4990abb4729d authored by Mads Kiilerich's avatar Mads Kiilerich
Browse files

import-checker: fix names of dynamically loaded modules

The import checker found standard library modules such as
lib-dynload/zlibmodule.so but saw that as a 'zlibmodule' module, not as the
'zlib' module.

Debian ships Python with most modules built-in and this incorrect handling of
dynamic modules did thus not cause problems on that platform.

Fedora ships Python with as many modules as possible loaded dynamically. That
made the import checker tests fail with incorrect classification of the
following modules: array fcntl grp itertools time zlib.

This change makes test-module-imports.t pass on Fedora.
parent a82de9dc4f77
No related branches found
No related tags found
No related merge requests found
......@@ -11,6 +11,5 @@
def dotted_name_of_path(path):
"""Given a relative path to a source file, return its dotted module name.
>>> dotted_name_of_path('mercurial/error.py')
'mercurial.error'
......@@ -15,5 +14,7 @@
>>> dotted_name_of_path('mercurial/error.py')
'mercurial.error'
>>> dotted_name_of_path('zlibmodule.so')
'zlib'
"""
parts = path.split('/')
parts[-1] = parts[-1][:-3] # remove .py
......@@ -17,6 +18,8 @@
"""
parts = path.split('/')
parts[-1] = parts[-1][:-3] # remove .py
if parts[-1].endswith('module'):
parts[-1] = parts[-1][:-6]
return '.'.join(parts)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment