Lennart, That seems to have done the trick. Between that fix and using the 64-bit cli.exe and gui.exe from http://bugs.python.org/setuptools/issue2, I was able to install setuptools on Python 3.0.1 64-bit on Windows Vista SP1 and run easy_install. For that build in particular, a Windows installer is available at http://dl.getdropbox.com/u/54081/setuptools-0.7a1.win-amd64.exe. I'll try to put together a 32-bit build also later. Thanks so much for doing the Python 3 port. I'll be sure to report back if I encounter any further problems. Now I can get started porting my namespace packages to Python 3. Jason
-----Original Message----- From: Lennart Regebro [mailto:regebro@gmail.com] Sent: Wednesday, 08 April, 2009 15:53 To: Jason R. Coombs Cc: distutils-sig@python.org Subject: Re: [Distutils] setuptools 0.7a for Python 3 fails to build on Windows
On Wed, Apr 8, 2009 at 21:12, Jason R. Coombs <jaraco@jaraco.com> wrote:
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.
No, if you do that everything explodes, and you can't even run python3.0 setup.py anymore. So that's definitely not right. :-)
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.
That change does still run all the tests at least, so it's worth a try. I changed DefaultProvider._get to:
def _get(self, path): stream = open(path, 'rb') try: data = stream.read() return data.decode() except UnicodeDecodeError: return data finally: stream.close()
Try if that makes a difference.
- require a parameter to indicate what type of content is expected.
Tricky, since _get is called from somewhere else than where the fact that it's cli.exe thet should be opened is set. There is too much iterators and indirection in pkg_resources for my small brain. I usually get a headache. :-)
-- Lennart Regebro: Pythonista, Barista, Notsotrista. http://regebro.wordpress.com/ +33 661 58 14 64