summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-08-19 07:42:31 +0000
committerZac Medico <zmedico@gentoo.org>2009-08-19 07:42:31 +0000
commite12fc4a5ee6d6820b4f7617ed5b22cabebe1ba8d (patch)
tree7225a7044af976d0b8aba8dd3193fec2e2c94cf1
parent2c1facb4462ccbaeb550547592385c56b6c87b20 (diff)
downloadportage-e12fc4a5ee6d6820b4f7617ed5b22cabebe1ba8d.tar.gz
portage-e12fc4a5ee6d6820b4f7617ed5b22cabebe1ba8d.tar.bz2
portage-e12fc4a5ee6d6820b4f7617ed5b22cabebe1ba8d.zip
If sys.getdefaultencoding() returns None (this can happen if python is built
with USE=build, in stage 1), fall back to _encodings['merge'] = 'ascii'. svn path=/main/trunk/; revision=14102
-rw-r--r--pym/portage/__init__.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 9cb3af2ae..186417e8d 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -127,6 +127,10 @@ _encodings = {
'repo.content' : 'utf_8',
}
+# This can happen if python is built with USE=build (stage 1).
+if _encodings['merge'] is None:
+ _encodings['merge'] = 'ascii'
+
# Deprecated attributes. Instead use _encodings directly.
_content_encoding = _encodings['content']
_fs_encoding = _encodings['fs']
@@ -352,7 +356,7 @@ def _ensure_default_encoding():
default_fallback = 'utf_8'
default_encoding = sys.getdefaultencoding().lower().replace('-', '_')
- filesystem_encoding = sys.getfilesystemencoding().lower().replace('-', '_')
+ filesystem_encoding = encodings['merge'].lower().replace('-', '_')
required_encodings = set(['ascii', 'utf_8'])
required_encodings.add(default_encoding)
required_encodings.add(filesystem_encoding)