Make _generate_hash_function() use _fs_encoding to encode the filename
authorZac Medico <zmedico@gentoo.org>
Sat, 15 Aug 2009 06:48:15 +0000 (06:48 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 15 Aug 2009 06:48:15 +0000 (06:48 -0000)
(if it's not already encoded), and enable errors='strict'.

svn path=/main/trunk/; revision=14060

pym/portage/checksum.py

index b22e62b6130fe4a0a49e45b8966cf652db818e36..330d85dfb6d26e65b6d0811c4a7cc6e53e62013f 100644 (file)
@@ -27,7 +27,8 @@ def _generate_hash_function(hashtype, hashobject, origin="unknown"):
                @type filename: String
                @return: The hash and size of the data
                """
-               f = open(_unicode_encode(filename), 'rb')
+               f = open(_unicode_encode(filename,
+                       encoding=_fs_encoding, errors='strict'), 'rb')
                blocksize = HASHING_BLOCKSIZE
                data = f.read(blocksize)
                size = 0L