FYI: Python-2.7 distutils incompatibility

Toshio Kuratomi a.badger at gmail.com
Tue Jan 4 02:23:56 UTC 2011


I mentioned this to dmalcolm as a possible bug on IRC and as I figured out
what's going on I felt I should share with others that might run into this.

In python-2.7, an incompatibility was introduced in what is allowed to be in
a setup.py file.  A setup.py looks something like this::

  #!/usr/bin/python -tt
  # -*- coding: utf-8 -*-

  from distutils.core import setup

  setup(name='test',
      version='1.0',
      description='Test',
      author='Toshio Kuratomi',
      author_email='toshio at fp.o',
      license='MIT',
      url='http://localhost/',
      download_url='http://localhost/',
      keywords='test',
      classifiers=[
            'Development Status :: 3 - Alpha',
          ],
  )

In python-2.7, the values of those entries to the setup function cannot be
unicode strings.  They must be byte strings (str type).  This is true even
if the value is all ASCII.  For instance, this is invalid::

  setup(name=u'test', [...]

Although this is a change in behaviour from earlier python versions, it is
now a documented behaviour (see the notes section of this link:
http://docs.python.org/distutils/setupscript.html#additional-meta-data ) so
it's not a bug, it's a feature ;-)

-Toshio
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
Url : http://lists.fedoraproject.org/pipermail/python-devel/attachments/20110103/19cec8f8/attachment.bin 


More information about the python-devel mailing list