summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2013-06-18 20:42:33 -0700
committerZac Medico <zmedico@gentoo.org>2013-06-18 20:42:33 -0700
commited5d9c98a0ddea543590516cae7ce54b30bf2a94 (patch)
treec07d520f8482d9bb05549d558f4d0d3d0915609d
parentRepoConfigLoader: refer to make.globals in comment (diff)
downloadportage-ed5d9c98a0ddea543590516cae7ce54b30bf2a94.tar.gz
portage-ed5d9c98a0ddea543590516cae7ce54b30bf2a94.tar.bz2
portage-ed5d9c98a0ddea543590516cae7ce54b30bf2a94.zip
RepoConfigLoader: pass source arg to read_file
The 'source' keyword argument is needed since otherwise ConfigParser may throw a TypeError because it assumes f.name is a native string rather than binary when constructing error messages.
-rw-r--r--pym/portage/repository/config.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py
index 1b15a398a..444e6a7f3 100644
--- a/pym/portage/repository/config.py
+++ b/pym/portage/repository/config.py
@@ -451,8 +451,10 @@ class RepoConfigLoader(object):
try:
# Python >=3.2
read_file = parser.read_file
+ source_kwarg = 'source'
except AttributeError:
read_file = parser.readfp
+ source_kwarg = 'filename'
for p in paths:
f = None
@@ -464,8 +466,13 @@ class RepoConfigLoader(object):
except EnvironmentError:
pass
else:
+ # The 'source' keyword argument is needed since
+ # otherwise ConfigParsier may throw a TypeError because
+ # it assumes that f.name is a native string rather
+ # than binary when constructing error messages.
+ kwargs = {source_kwarg: p}
try:
- read_file(f)
+ read_file(f, **portage._native_kwargs(kwargs))
except ParsingError as e:
writemsg(
_("!!! Error while reading repo config file: %s\n") % e,