[Distutils] setuptools and py3k

Ronald Oussoren ronaldoussoren at mac.com
Sun Jun 7 16:46:10 CEST 2009


Hi,

I want to port pyobjc to python 3.1 and need a py3k port of setuptools  
for that. I'm slowy moving forward with the latter, partly based on  
earlier discussions on this list.  I don't have anything useful to  
share at the moment, beyond a setup3.py file (see below).

But first a question:  some of the tests use docutils and I'm having a  
hard time getting those to run with both python3 and python2. The bit  
that's particularly annoying is this bit of api_tests.txt:

    Note that asking for a conflicting version of a distribution  
already in a
    working set triggers a ``pkg_resources.VersionConflict`` error:

        >>> ws.find(Requirement.parse("Bar==1.0")) # doctest:  
+NORMALIZE_WHITESPACE
        Traceback (most recent call last):
          ...
        VersionConflict: (Bar 0.9 (http://example.com/something),
                       Requirement.parse('Bar==1.0'))

This passes with 2.6, but fails in 3.1 because it expects  
'pkg_resources.VersionConflict' rather than just 'VersionConflict'.  
What's the best way to work around this issue?


The attached file "setup3.py" is a script that incrementally copies  
the setuptools source-tree to a temporary directory, runs 2to3 on that  
copy and exec-s the contents of the translated 'setup.py' file. This  
seems to be good enough to be able to install setuptools for python2  
and python3 using the same code-base.   That said, this is just the  
first step of a python3 port there need to be changes to the  
setuptools sources to be able to actually use the translated sources.

Ronald

-------------- next part --------------
A non-text attachment was scrubbed...
Name: setup3.py
Type: text/x-python-script
Size: 3282 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20090607/ef407691/attachment.bin>
-------------- next part --------------



More information about the Distutils-SIG mailing list