diff options
author | Zac Medico <zmedico@gentoo.org> | 2009-08-04 18:45:48 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2009-08-04 18:45:48 +0000 |
commit | 141eff421a45892315b2b871828db3899246872e (patch) | |
tree | 7a06de67926b579da51fed7663a2ca47ce5142b2 | |
parent | fad324877f76279dcd9efa5dac07bc97841329b1 (diff) | |
download | portage-141eff421a45892315b2b871828db3899246872e.tar.gz portage-141eff421a45892315b2b871828db3899246872e.tar.bz2 portage-141eff421a45892315b2b871828db3899246872e.zip |
Open CONTENTS in text mode (to avoid UnicodeEncodeError). Thanks to Markos
Chandras <hwoarang@gentoo.org> for reporting.
svn path=/main/trunk/; revision=13902
-rw-r--r-- | pym/portage/dbapi/vartree.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 88ec7b3c7..e759a9b15 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -37,6 +37,7 @@ from portage import listdir, dep_expand, digraph, flatten, key_expand, \ from portage.cache.mappings import slot_dict_class +import codecs import os, re, shutil, stat, errno, copy, subprocess import logging import shlex @@ -1864,7 +1865,8 @@ class dblink(object): return self.contentscache pkgfiles = {} try: - myc = open(contents_file,"r") + myc = codecs.open(contents_file, mode='r', + encoding='utf_8', errors='replace') except EnvironmentError, e: if e.errno != errno.ENOENT: raise @@ -3432,7 +3434,8 @@ class dblink(object): lcfile.close() # open CONTENTS file (possibly overwriting old one) for recording - outfile = open(os.path.join(self.dbtmpdir, "CONTENTS"),"w") + outfile = codecs.open(os.path.join(self.dbtmpdir, 'CONTENTS'), + mode='w', encoding='utf_8', errors='replace') self.updateprotect() |