[Distutils] setuptools 0.7a for Python 3 fails to build on Windows

Jason R. Coombs jaraco at jaraco.com
Wed Apr 8 21:12:36 CEST 2009


Thanks to Lennart Regebro for putting together a build of setuptools for
Python 3 here:
http://regebro.wordpress.com/2009/02/01/setuptools-and-easy_install-for-pyth
on-3/

Unfortunately, the package fails to build on Windows.  Refer to the blog
post (and comments) for details.

The problem occurs when get_script_args calls resource_string for the
'cli.exe' launcher.

It turns out that in Python 3, the following command yields the same error:

>>> open('setuptools/cli.exe', 'rt').read()

resource_string ultimately executes the same command, which is why the build
fails.

The correct thing to do in this particular case is to open the file in
binary mode, which returns `bytes` instead of a Unicode `str`.
Unfortunately, I'm not sure what negative impact would come from altering
pkg_resources.DefaultProvider._get to always read bytes, and that doesn't
strike me as the correct solution.

So, I'm writing here to ask: what should be done about pkg_resources in
Python 3 to support getting a package resource that's binary data?

As I see it, there are a few options,
- always have pkg_resources providers return bytes.
- read the bytes and try converting to str, falling back to bytes on
failure.
- require a parameter to indicate what type of content is expected.

There are probably others.  Any suggestions are appreciated.

Regards,
Jason
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 6998 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20090408/2aaae567/attachment.bin>


More information about the Distutils-SIG mailing list