From ed303d89530b2aafaf1c8a95b2828d35dac7e006 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 7 Jul 2011 12:10:08 -0700 Subject: Remove the _ensure_encodings module. This was only needed for ancient versions of python built with USE=build since the ebuilds used to remove the encodings module in that case. Since the StreamWriter and StreamReader classes may be deprecated in the near future, now would be a good time to stop using them. --- pym/portage/__init__.py | 24 ---- pym/portage/_ensure_encodings.py | 132 --------------------- .../test_lazy_import_portage_baseline.py | 2 +- 3 files changed, 1 insertion(+), 157 deletions(-) delete mode 100644 pym/portage/_ensure_encodings.py (limited to 'pym') diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index bc2eedb18..47e2e48e6 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -327,30 +327,6 @@ _python_interpreter = os.path.realpath(sys.executable) _bin_path = PORTAGE_BIN_PATH _pym_path = PORTAGE_PYM_PATH -def _ensure_default_encoding(): - - default_encoding = sys.getdefaultencoding().lower().replace('-', '_') - filesystem_encoding = _encodings['merge'].lower().replace('-', '_') - required_encodings = set(['ascii', 'utf_8']) - required_encodings.add(default_encoding) - required_encodings.add(filesystem_encoding) - missing_encodings = set() - for codec_name in required_encodings: - try: - codecs.lookup(codec_name) - except LookupError: - missing_encodings.add(codec_name) - - if not missing_encodings: - return - - from portage import _ensure_encodings - _ensure_encodings._setup_encodings(default_encoding, - filesystem_encoding, missing_encodings) - -# Do this ASAP since writemsg() might not work without it. -_ensure_default_encoding() - def _shell_quote(s): """ Quote a string in double-quotes and use backslashes to diff --git a/pym/portage/_ensure_encodings.py b/pym/portage/_ensure_encodings.py deleted file mode 100644 index 5e62843f1..000000000 --- a/pym/portage/_ensure_encodings.py +++ /dev/null @@ -1,132 +0,0 @@ -# Copyright 2010 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -import codecs - -_codec_map = None - -def _setup_encodings(default_encoding, filesystem_encoding, missing_encodings): - """ - The