[Python-porting] Python 2/3 compatible distutils installation?
Barry Warsaw
barry at python.org
Wed May 16 23:36:25 CEST 2012
On May 16, 2012, at 12:24 PM, Chris Jerdonek wrote:
>I also encountered this issue recently. Can you just avoid importing
>anything from your package from within setup.py?
It's not actually *my* setup.py, but I get what you're saying. In my own
packages, I do try to avoid those types of imports.
>It looks like you're importing your package mostly just to get the
>__version__ number in your package's __init__.py (though I also see you use
>it in the cmdclass argument to setup(), which might require a different
>work-around).
Yep. It seems like the testtools.TestCommand is required.
>The consequence for me was that I needed to maintain the version
>string for my project in two places: both setup.py and my package's
>__init__.py (and I added a unit test to check that they were the
>same). I rationalized this by telling myself that the script
>responsible for installing a project shouldn't need to be able to run
>the project: it should be independent.
In my own packages, I still keep the version string in my __init__.py, but I
don't import it from setup.py to get at it. Instead, I usually just open the
file and grep its lines for the value. I also have a helper to make this
easier, e.g.
http://bazaar.launchpad.net/~barry/flufl.enum/trunk/view/head:/setup_helpers.py
and its use in my setup.py
http://bazaar.launchpad.net/~barry/flufl.enum/trunk/view/head:/setup.py
Cheers,
-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-porting/attachments/20120516/561d4773/attachment.pgp>
More information about the Python-porting
mailing list