[Distutils] New buildout release needed

Reinout van Rees reinout at vanrees.org
Wed Jul 1 12:53:03 CEST 2015

Wichert Akkerman schreef op 01-07-15 om 06:08:
> On 01 Jul 2015, at 04:45, Reinout van Rees<reinout at vanrees.org>  wrote:
>> >And I've fixed several issues dealing with non-ascii filenames. Apparently, if you install pyramid (for instance), buildout will fail to run. Apparently it is enough to install something like mr.bob to break buildout totally. It is now fixed inhttps://github.com/buildout/buildout/pull/250
> That change looks wrong to me. Why would os.walk() need unicode on Python 2? One of the really nice things about Python 2 is that you can do not need to pretend filenames are unicode. I suspect the real problem there is that you are somehow getting a unicode component in a path/dirnames, which you should not do on Python 2.
Your comment made me re-visit my fix. You're right that it normally 
should work. I did some more pdb'ing, now with the assumption that there 
must be something else that's wrong that I overlooked. Bingo!

Turns out the actual problem is the .encode() that happens before the 
hash gets updated.
A hash needs bytecode, not unicode. Thus the .encode().
But on python 2, it is already bytecode.
And on python 2 the .encode() raises the unicode error when there are 
non-ascii characters.

Solution: a small if statement that only calls .encode() when it is unicode.

See https://github.com/buildout/buildout/pull/252

Can you look at that one?


Reinout van Rees                          http://reinout.vanrees.org/
reinout at vanrees.org                   http://www.nelen-schuurmans.nl/
"Learning history by destroying artifacts is a time-honored atrocity"

More information about the Distutils-SIG mailing list