diff options
Diffstat (limited to 'pym/portage')
-rw-r--r-- | pym/portage/__init__.py | 9 | ||||
-rw-r--r-- | pym/portage/dbapi/porttree.py | 4 | ||||
-rw-r--r-- | pym/portage/dbapi/vartree.py | 3 | ||||
-rw-r--r-- | pym/portage/news.py | 4 | ||||
-rw-r--r-- | pym/portage/package/ebuild/doebuild.py | 7 | ||||
-rw-r--r-- | pym/portage/repository/config.py | 2 |
6 files changed, 21 insertions, 8 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 3bae4deff..94ca7b90f 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -198,6 +198,15 @@ else: _native_string = _unicode_encode +if sys.hexversion >= 0x20605f0: + def _native_kwargs(kwargs): + return kwargs +else: + # Avoid "TypeError: keywords must be strings" issue triggered + # by unicode_literals: http://bugs.python.org/issue4978 + def _native_kwargs(kwargs): + return dict((_native_string(k), v) for k, v in kwargs.iteritems()) + class _unicode_func_wrapper(object): """ Wraps a function, converts arguments from unicode to bytes, diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index 321b6758a..e21e53ce6 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -155,10 +155,10 @@ class portdbapi(dbapi): # portage group. depcachedir_unshared = True else: - cache_kwargs.update({ + cache_kwargs.update(portage._native_kwargs({ 'gid' : portage_gid, 'perms' : 0o664 - }) + })) # If secpass < 1, we don't want to write to the cache # since then we won't be able to apply group permissions diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 30add8a89..20a114bda 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -4837,7 +4837,8 @@ class dblink(object): else: kwargs['mode'] = 'w' kwargs['encoding'] = _encodings['repo.content'] - write_atomic(os.path.join(self.dbdir, fname), data, **kwargs) + write_atomic(os.path.join(self.dbdir, fname), data, + **portage._native_kwargs(kwargs)) def getelements(self,ename): if not os.path.exists(self.dbdir+"/"+ename): diff --git a/pym/portage/news.py b/pym/portage/news.py index 94ec8f164..408fb5c5f 100644 --- a/pym/portage/news.py +++ b/pym/portage/news.py @@ -13,6 +13,7 @@ import io import logging import os as _os import re +import portage from portage import OrderedDict from portage import os from portage import _encodings @@ -241,7 +242,8 @@ class NewsItem(object): for values in self.restrictions.values(): any_match = False for restriction in values: - if restriction.checkRestriction(**kwargs): + if restriction.checkRestriction( + **portage._native_kwargs(kwargs)): any_match = True if not any_match: all_match = False diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py index 3e8ff0138..71a6f156f 100644 --- a/pym/portage/package/ebuild/doebuild.py +++ b/pym/portage/package/ebuild/doebuild.py @@ -135,7 +135,7 @@ def _doebuild_spawn(phase, settings, actionmap=None, **kwargs): settings['EBUILD_PHASE'] = phase try: - return spawn(cmd, settings, **kwargs) + return spawn(cmd, settings, **portage._native_kwargs(kwargs)) finally: settings.pop('EBUILD_PHASE', None) @@ -1453,14 +1453,15 @@ def spawn(mystring, mysettings, debug=0, free=0, droppriv=0, sesandbox=0, fakero mysettings["PORTAGE_SANDBOX_T"]) if keywords.get("returnpid"): - return spawn_func(mystring, env=mysettings.environ(), **keywords) + return spawn_func(mystring, env=mysettings.environ(), + **portage._native_kwargs(keywords)) proc = EbuildSpawnProcess( background=False, args=mystring, scheduler=SchedulerInterface(portage._internal_caller and global_event_loop() or EventLoop(main=False)), spawn_func=spawn_func, - settings=mysettings, **keywords) + settings=mysettings, **portage._native_kwargs(keywords)) proc.start() proc.wait() diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py index a1c1f79ce..8a110e990 100644 --- a/pym/portage/repository/config.py +++ b/pym/portage/repository/config.py @@ -238,7 +238,7 @@ class RepoConfig(object): if self.disable_manifest: kwds['from_scratch'] = True kwds['find_invalid_path_char'] = self.find_invalid_path_char - return manifest.Manifest(*args, **kwds) + return manifest.Manifest(*args, **portage._native_kwargs(kwds)) def update(self, new_repo): """Update repository with options in another RepoConfig""" |