[Distutils] setuptools and use_2to3

Lennart Regebro regebro at gmail.com
Mon Nov 11 21:45:53 CET 2013


On Mon, Nov 11, 2013 at 5:29 PM, Paul Moore <p.f.moore at gmail.com> 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.
>
> 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.

If 2to3 is being run you'll get quite a lot of fairly obvious output
to that effect. So it sounds like it's not.

A quick look at bdist_egg seems to indicate that it never runs the
build_py step, which is what runs 2to3. So this may be a bug.

//Lennart


More information about the Distutils-SIG mailing list