summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-08-19 06:41:21 +0000
committerZac Medico <zmedico@gentoo.org>2009-08-19 06:41:21 +0000
commit032dd0485138d1757d1fe3bab37815a15dcb9c1f (patch)
tree900d633b4ec2c5a9572b5822b5c6e7e44f9f44f7
parent2832db9bbc909f35cde6df3cd913237d759375e3 (diff)
downloadportage-032dd0485138d1757d1fe3bab37815a15dcb9c1f.tar.gz
portage-032dd0485138d1757d1fe3bab37815a15dcb9c1f.tar.bz2
portage-032dd0485138d1757d1fe3bab37815a15dcb9c1f.zip
Use _encodings['repo.content'] for decoding profiles.desc, ChangeLog,
metadata.xml, and ebuilds. svn path=/main/trunk/; revision=14098
-rwxr-xr-xbin/repoman16
-rw-r--r--pym/portage/__init__.py1
2 files changed, 12 insertions, 5 deletions
diff --git a/bin/repoman b/bin/repoman
index 368902255..aecd45ca0 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -40,6 +40,8 @@ except ImportError:
import portage
portage._disable_legacy_globals()
from portage import os
+from portage import _encodings
+from portage import _unicode_encode
try:
from repoman.checks import run_checks
@@ -600,8 +602,9 @@ for path in portdb.porttrees:
desc_path = os.path.join(path, 'profiles', 'profiles.desc')
try:
- desc_file = codecs.open(desc_path, mode='r',
- encoding='utf_8', errors='replace')
+ desc_file = codecs.open(_unicode_encode(desc_path,
+ encoding=_encodings['fs'], errors='strict'),
+ mode='r', encoding=_encodings['repo.content'], errors='replace')
except EnvironmentError:
pass
else:
@@ -971,8 +974,9 @@ for x in scanlist:
continue
try:
line = 1
- for l in codecs.open(os.path.join(checkdir, y), mode='r',
- encoding='utf_8'):
+ for l in codecs.open(_unicode_encode(os.path.join(checkdir, y),
+ encoding=_encodings['fs'], errors='strict'),
+ mode='r', encoding=_encodings['repo.content']):
line +=1
except UnicodeDecodeError, ue:
stats["file.UTF8"] += 1
@@ -1553,7 +1557,9 @@ for x in scanlist:
full_path = os.path.join(repodir, relative_path)
try:
# All ebuilds should have utf_8 encoding.
- f = codecs.open(full_path, mode='r', encoding='utf_8')
+ f = codecs.open(_unicode_encode(full_path,
+ encoding=_encodings['fs'], errors='strict'),
+ mode='r', encoding=_encodings['repo.content'])
try:
for check_name, e in run_checks(f, pkg):
stats[check_name] += 1
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 480e00f81..9cb3af2ae 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -124,6 +124,7 @@ _encodings = {
'content' : 'utf_8',
'fs' : 'utf_8',
'merge' : sys.getfilesystemencoding(),
+ 'repo.content' : 'utf_8',
}
# Deprecated attributes. Instead use _encodings directly.