[Distutils] Comments on Python 3 support for Distribute.

Lennart Regebro regebro at gmail.com
Fri Sep 18 08:24:16 CEST 2009

Hiya all!

Tarek alerted me to that Martin v Löwis has checked in the great job
done during the DZUG-sprint of adding Python 3 support to the 0.6
maintenance branch. I tested it yesterday, and I have two comments.

1. First a little heads up!!

When I tested this yesterday, I first ran the tests for various Python
versions, and then I tried to install it on Python 3.1. Unfortunately
I got a syntax error. Something was not properly converted to Python
3. Looking at the source code of the file in question showed that it
WAS converted. I thought it was the PYC-file, but then I realized you
can't get syntax-error in pyc-files. I deleted all in site-packages,
and ran the install again: Same result.

Finally I fixed it by deleting all in site-packages, and rm -rf dist
build in the distribute checkout and also deleting all pyc-files in
the distribute checkout and trying again. Since then, I have not been
able to repeat the problem. (Deleting just build and dist or just the
pyc-files or just everything in site-setup did not work. Only when I
deleted *all* of these did the problem go away).

I suspect that the existence of my setuptools port in the Python 3.1
install before running the new one made something very strange. But it
made the strangeness in either build/ or dist/. So a heads up to
everyone here: If you have used my setuptools port, make sure you
delete all traces of it from your Python 3 install *before* attempting
to install Distribute on Python 3.

2. There is now a build_py that will run 2to3 on the code. That's
cool, but there doesn't seem to be a way to enable it. It looks for a
setuptools.use_2to3 attribute to check if it should be used, but I
couldn't see a way of setting that. Passing it in as a parameter to
setup() gives you a warning, that the parameter is unknown.

How should it be done?

Lennart Regebro: Python, Zope, Plone, Grok
+33 661 58 14 64

More information about the Distutils-SIG mailing list