[issue13317] building with 2to3 generates wrong import paths because build_ext is run after build_py

simohe report at bugs.python.org
Thu Nov 3 21:51:35 CET 2011


simohe <simohe at besonet.ch> added the comment:

fix_imports rewrites the import statements to local or global. When a python module loads a local extension module, this import statement should be converted to a local import (from . import extensionmodule). But when the extension module is not built yet, fix_imports does not find them (no file named extenstionmodule.[so|sl]). So it suggests a global import (import extensionmodule).


The original comment is a slightly modified version of this here:
http://selenic.com/hg/file/afc02adf4ded/contrib/setup3k.py#l223


short summary:

build.sub_commands in distutils.command.build should list "build_ext" before "build_py".
lib2to3.fixes.fix_import will write global instead of local import statements else.

----------
assignee:  -> tarek
components: +Distutils -Build
nosy: +tarek

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13317>
_______________________________________


More information about the Python-bugs-list mailing list