diff options
author | Zac Medico <zmedico@gentoo.org> | 2009-03-11 06:30:26 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2009-03-11 06:30:26 +0000 |
commit | 54269eca2afabd10b56c0c0677cb3f6d9a5d2585 (patch) | |
tree | b76bc6d6710fa587083f92cb5b4f8a75fed1ffe2 | |
parent | bd85a50aa9296aa120a92ecf8f6fe206cb721062 (diff) | |
download | portage-54269eca2afabd10b56c0c0677cb3f6d9a5d2585.tar.gz portage-54269eca2afabd10b56c0c0677cb3f6d9a5d2585.tar.bz2 portage-54269eca2afabd10b56c0c0677cb3f6d9a5d2585.zip |
When checking ebuild content, use codecs.open() to force utf_8 encoding for
py3k compatibility (all ebuilds should have utf_8 encoding). (trunk r12733)
svn path=/main/branches/2.1.6/; revision=12982
-rwxr-xr-x | bin/repoman | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/bin/repoman b/bin/repoman index 4c242c045..7bb507d98 100755 --- a/bin/repoman +++ b/bin/repoman @@ -1444,14 +1444,18 @@ for x in scanlist: # Syntax Checks relative_path = os.path.join(x, y + ".ebuild") full_path = os.path.join(repodir, relative_path) - f = open(full_path) try: - for check_name, e in run_checks(f, pkg): - stats[check_name] += 1 - fails[check_name].append(relative_path + ': %s' % e) - finally: - f.close() - del f + # All ebuilds should have utf_8 encoding. + f = codecs.open(full_path, mode='r', encoding='utf_8') + try: + for check_name, e in run_checks(f, pkg): + stats[check_name] += 1 + fails[check_name].append(relative_path + ': %s' % e) + finally: + f.close() + except UnicodeDecodeError: + # A file.UTF8 failure will have already been recorded above. + pass if options.force: # The dep_check() calls are the most expensive QA test. If --force |