From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1RJgFS-0000kv-BU for garchives@archives.gentoo.org; Fri, 28 Oct 2011 06:49:02 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 2189D21C039; Fri, 28 Oct 2011 06:48:54 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id E1A3621C039 for ; Fri, 28 Oct 2011 06:48:53 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 6096C1B4013 for ; Fri, 28 Oct 2011 06:48:53 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 874F280042 for ; Fri, 28 Oct 2011 06:48:52 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <0902b4094895a91d6784eab93eb5016987177f04.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/repository/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/repository/config.py X-VCS-Directories: pym/portage/repository/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 0902b4094895a91d6784eab93eb5016987177f04 Date: Fri, 28 Oct 2011 06:48:52 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: d4189de7aa77f807237bd0718a2426a1 commit: 0902b4094895a91d6784eab93eb5016987177f04 Author: Zac Medico gentoo org> AuthorDate: Fri Oct 28 06:48:44 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Fri Oct 28 06:48:44 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D0902b409 RepoConfigLoader: use readfp for unicode --- pym/portage/repository/config.py | 25 +++++++++++++++++++++---- 1 files changed, 21 insertions(+), 4 deletions(-) diff --git a/pym/portage/repository/config.py b/pym/portage/repository/co= nfig.py index 15c7ec5..d6a648e 100644 --- a/pym/portage/repository/config.py +++ b/pym/portage/repository/config.py @@ -326,10 +326,27 @@ class RepoConfigLoader(object): def _parse(paths, prepos, ignored_map, ignored_location_map): """Parse files in paths to load config""" parser =3D SafeConfigParser() - try: - parser.read(paths) - except ParsingError as e: - writemsg(_("!!! Error while reading repo config file: %s\n") % e, noi= selevel=3D-1) + # use readfp in order to control decoding of unicode + for p in paths: + f =3D None + try: + f =3D io.open(_unicode_encode(p, + encoding=3D_encodings['fs'], errors=3D'strict'), + mode=3D'r', encoding=3D_encodings['repo.content'], + errors=3D'replace') + except EnvironmentError: + pass + else: + try: + parser.readfp(f) + except ParsingError as e: + writemsg(_unicode_decode( + _("!!! Error while reading repo config file: %s\n") + ) % e, noiselevel=3D-1) + finally: + if f is not None: + f.close() + prepos['DEFAULT'] =3D RepoConfig("DEFAULT", parser.defaults()) for sname in parser.sections(): optdict =3D {}