summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-08-20 23:09:43 +0000
committerZac Medico <zmedico@gentoo.org>2009-08-20 23:09:43 +0000
commitb12ad1c74a820196faa930353cdd021a33cb6958 (patch)
tree15935d9a3628e91d73e6858468c0f915982936cc
parentf3392a373d255aa14b86a777ee62ae9a067907d2 (diff)
downloadportage-b12ad1c74a820196faa930353cdd021a33cb6958.tar.gz
portage-b12ad1c74a820196faa930353cdd021a33cb6958.tar.bz2
portage-b12ad1c74a820196faa930353cdd021a33cb6958.zip
Use _encodings where appropriate.
svn path=/main/trunk/; revision=14106
-rw-r--r--pym/_emerge/changelog.py8
-rw-r--r--pym/_emerge/emergelog.py8
2 files changed, 12 insertions, 4 deletions
diff --git a/pym/_emerge/changelog.py b/pym/_emerge/changelog.py
index 4adb8b25b..0fdf5880a 100644
--- a/pym/_emerge/changelog.py
+++ b/pym/_emerge/changelog.py
@@ -7,6 +7,8 @@ import re
import portage
from portage import os
+from portage import _encodings
+from portage import _unicode_encode
def calc_changelog(ebuildpath,current,next):
if ebuildpath == None or not os.path.exists(ebuildpath):
@@ -19,8 +21,10 @@ def calc_changelog(ebuildpath,current,next):
next = next[:-3]
changelogpath = os.path.join(os.path.split(ebuildpath)[0],'ChangeLog')
try:
- changelog = codecs.open(portage._unicode_encode(changelogpath),
- mode='r', encoding='utf_8', errors='replace').read()
+ changelog = codecs.open(_unicode_encode(changelogpath,
+ encoding=_encodings['fs'], errors='strict'),
+ mode='r', encoding=_encodings['repo.content'], errors='replace'
+ ).read()
except SystemExit, e:
raise # Needed else can't exit
except:
diff --git a/pym/_emerge/emergelog.py b/pym/_emerge/emergelog.py
index 01de27a4a..cdc60767b 100644
--- a/pym/_emerge/emergelog.py
+++ b/pym/_emerge/emergelog.py
@@ -7,6 +7,8 @@ import sys
import time
import portage
from portage import os
+from portage import _encodings
+from portage import _unicode_encode
from portage.data import secpass
from portage.output import xtermTitle
@@ -25,8 +27,10 @@ def emergelog(xterm_titles, mystr, short_msg=None):
xtermTitle(short_msg)
try:
file_path = os.path.join(_emerge_log_dir, 'emerge.log')
- mylogfile = codecs.open(portage._unicode_encode(file_path), mode='a',
- encoding='utf_8', errors='replace')
+ mylogfile = codecs.open(_unicode_encode(file_path,
+ encoding=_encodings['fs'], errors='strict'),
+ mode='a', encoding=_encodings['content'],
+ errors='backslashreplace')
portage.util.apply_secpass_permissions(file_path,
uid=portage.portage_uid, gid=portage.portage_gid,
mode=0660)