aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfuzzyray <fuzzyray@gentoo.org>2010-11-19 20:18:46 +0000
committerfuzzyray <fuzzyray@gentoo.org>2010-11-19 20:18:46 +0000
commit022aa0034947b798dd3fe28181559b906c78517b (patch)
tree36dda025e713d522dd1b9d2fec22235a3eac37e1
parentRevert: Use join() rather than string printing. (diff)
downloadgentoolkit-022aa0034947b798dd3fe28181559b906c78517b.tar.gz
gentoolkit-022aa0034947b798dd3fe28181559b906c78517b.tar.bz2
gentoolkit-022aa0034947b798dd3fe28181559b906c78517b.zip
Fix UnicodeDecodeError in setup.py, bug 346001
svn path=/trunk/gentoolkit/; revision=858
-rwxr-xr-xsetup.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/setup.py b/setup.py
index 55cb3bd..91f9e9c 100755
--- a/setup.py
+++ b/setup.py
@@ -10,6 +10,7 @@ from distutils import core, log
from glob import glob
import os
+import io
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'pym'))
@@ -59,13 +60,13 @@ class set_version(core.Command):
def sub(files, pattern):
for f in files:
updated_file = []
- with open(f) as s:
+ with io.open(f, 'r', 1, 'utf_8') as s:
for line in s:
newline = re.sub(pattern, '"%s"' % ver, line, 1)
if newline != line:
log.info("%s: %s" % (f, newline))
updated_file.append(newline)
- with open(f, 'w') as s:
+ with io.open(f, 'w', 1, 'utf_8') as s:
s.writelines(updated_file)
quote = r'[\'"]{1}'
bash_re = r'(?<=VERSION=)' + quote + '[^\'"]*' + quote