[Distutils] 2to3 and version numbers with distribute

Andrew McNabb amcnabb at mcnabbs.org
Wed Feb 8 22:05:02 CET 2012


I'm trying to use 2to3 in setup.py for the first time.  I have
distribute installed, so it sounds like I should be able to just add
"use_2to3=True" to my call to setup, and things should just work.

Unfortunately, the setup.py is currently importing the package in order
to determine the version number.  Specifically, setup.py has:

from xyz import version
setup(name='xyz', version=version.VERSION, ...)

If I run "python3 setup.py build", this fails because the "from xyz
import version" causes lots of python3-incompatible code to get called.
It seems like there's probably an easy way around this that I'm missing.

In theory, I could specify the version number in two different places
and hope that they would stay synced, but I'm not smart enough to pull
that off. :)  Is there anything else I should try?  Thanks.

--
Andrew McNabb
http://www.mcnabbs.org/andrew/
PGP Fingerprint: 8A17 B57C 6879 1863 DE55  8012 AB4D 6098 8826 6868


More information about the Distutils-SIG mailing list