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

Vinay Sajip vinay_sajip at yahoo.co.uk
Sat Jul 6 12:19:07 CEST 2013


mbogosian <setuptools <at> bugs.python.org> writes:

> 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.
>

These appear to be because distutils (not setuptools) is unduly restrictive,
refusing to accept unicode when it could do so.

>
".../lib/python2.7/distutils/command/build_py.py",
> line 333, in build_module
>     "'package' must be a string (dot-separated), list, or tuple")
> TypeError: 'package' must be a string (dot-separated), list, or tuple

distutils code is testing for str (as opposed to list/tuple), but it could
as well test for basestring here.

>   File
".../lib/python2.7/distutils/cmd.py",
> line 216, in _ensure_stringlike
>     "'%s' must be a %s (got `%s`)" % (option, what, val)
> distutils.errors.DistutilsOptionError: 'egg_base' must be a directory name
(got `src`)

Again, this is in distutils. It seems as if testing for basestring rather
than str would be needed.

There could well be other places in distutils where it's testing for str
where basestring would do, but I'm not sure whether these would be regarded
as bugs for 2.7.

Regards,

Vinay Sajip



More information about the Distutils-SIG mailing list