Skip to content

Allow Python module name to import to be overridden

Simon McVittie requested to merge wip/929957 into master

Some Python module names undergo a lossy transformation to be mapped to Debian package names. For example, the Xlib module has to be packaged as python3-xlib, which is not enough information for autodep8 to infer that it should import Xlib.

Some Debian Python packages have their name based on their PKG-INFO or .egg-info files rather than the name that is to be imported, which means autodep8 cannot guess the right name to import. For example, python3-pypcap is to be used via import pcap. This is at least arguably incorrect, but is somewhat common.

Similarly, some packages are named with a non-canonical transformation of their Python module name, for example the oslo family of packages (#884181) which are packaged with names like python3-oslo.log but imported with a name like oslo_log.

Taking inspiration from the Perl autopkgtest in pkg-perl-tools, I've allowed the import-name file to include comments and blank lines (which are ignored), or even multiple lines (of which only the first is used for now).

Signed-off-by: Simon McVittie smcv@debian.org
Closes: #884181
Closes: #929957


This is an alternative to !6 (closed); see also my comment there.

Merge request reports

Loading