[Distutils] [issue152] setuptools breaks with from __future__ import unicode_literals in setup.py

Toshio Kuratomi a.badger at gmail.com
Sat Jul 6 10:11:50 CEST 2013


On Sat, Jul 06, 2013 at 06:52:05AM +0000, mbogosian wrote:
> 
> New submission from mbogosian:
> 
> unicode_literals break a bunch of stuff in setuptools. Considering they may become the default at some point, this should be fixed...? I do not know if this is related to issue 78.
> 
> To reproduce, run the attached setup.py (output below). Comment out the unicode_literals line in setup.py and try it again (everything should work).
> 
> % DISTUTILS_DEBUG=t python -c 'import setuptools ; print setuptools.__version__'
> 0.8
> % unzip -d foo_test.zip ; cd foo_test
> ...
> % DISTUTILS_DEBUG=t python setup.py build
[snip output]
> % DISTUTILS_DEBUG=t python setup.py nosetests
[snip output]

Not sure what the unicode model is in setuptools but one way to look at this
is that in python2, the setuptools API takes byte str and in python3, the API
takes unicode str.  So this is a case of the setup.py being invalid.

If you have:
    from __future__ import unicode_literals

That doesn't change what the api takes as input; it only changes how you
express it.  So a package author who does from __future__ import
unicode_literals would also need to do this to make things work:

    'package_dir'           : { '': b'src' },
    'packages'              : setuptools.find_packages(b'src', exclude = ( b'foo', b'test', b'test.*' )),

Someone else will have to speak to whether that's the intended model,
though.

-Toshio
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20130706/f8fec169/attachment.pgp>


More information about the Distutils-SIG mailing list