[Python-Dev] packaging backport

Tarek Ziadé ziade.tarek at gmail.com
Tue Jun 21 15:43:09 CEST 2011

On Tue, Jun 21, 2011 at 3:37 PM, Joe Amenta <amentajo at msu.edu> wrote:
> Yes, 2to3/3to2 does not do anything fancy like that.  The tools are purely
> concerned with syntax, whereas renaming imports is semantic.  The good news
> is that this line:
> import packaging as _myPackaging
> can be replaced by:
> import distutils2 as _myPackaging
> and code that uses _myPackaging will work.  I've attached a fixer that can
> go into your lib3to2/fixes folder.  You should also edit fix_imports.py and
> add the line:
> "packaging" : "distutils2",
> to the MAPPING dictionary near the top, then you can run 3to2 like this:
> 3to2 -fpackaging -fimports files_to_fix.py
> (-w option to write changes to the files modified)
> Hope this helps,

It does, thanks a lot !


Tarek Ziadé | http://ziade.org

More information about the Python-Dev mailing list