From e12fc4a5ee6d6820b4f7617ed5b22cabebe1ba8d Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 19 Aug 2009 07:42:31 +0000 Subject: [PATCH] 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 --- pym/portage/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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) -- 2.26.2