[Distutils] setuptools and use_2to3

Marius Gedminas marius at pov.lt
Mon Nov 11 18:26:22 CET 2013

On Mon, Nov 11, 2013 at 04:29:32PM +0000, Paul Moore wrote:
> I'm trying to convert a setup.py to use setuptools  (specifically the
> docutils build, FWIW). The existing setup.py has some custom command
> stuff to run 2to3 on build.

Aside: I believe there's consensus now that 2to3 is not the best way to
support Python 2.x and 3.x.  It's not that hard to have a single source
tree in a portable subset of Python 2.x and 3.x.  See python3porting.com
and https://pypi.python.org/pypi/six.

> As I understand it, setuptools should do this automatically by using
> use_2to3=True.
> So, I've changed the code to just do:
> setup(
>     ...
>     packages=find_packages(),
>     use_2to3=True,
>     ...
> )
> However, when I do python setup.py bdist_wheel, I find that
> docutils/__init__.py within the wheel still contains (for example)
>     class ApplicationError(StandardError):
>         ...
> So the StandardError -> Exception fixer isn't being run.
> Am I doing something wrong here? The setuptools documentation isn't
> very clear on what I should do, or what to expect.

I wouldn't be surprised to learn that bdist_wheel doesn't support
use_2to3, but I don't actually *know* that for a fact, since I never
used 2to3.

Marius Gedminas
What goes up, must come down. Ask any system administrator.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20131111/d2570b01/attachment.sig>

More information about the Distutils-SIG mailing list