diff options
author | Paul Varner <fuzzyray@gentoo.org> | 2016-08-15 16:02:03 -0500 |
---|---|---|
committer | Paul Varner <fuzzyray@gentoo.org> | 2016-08-15 16:02:03 -0500 |
commit | c8783ccb225cddb43052463c092e8edc091c371a (patch) | |
tree | 70421ecb7750a4876429747bcb0996fe86fbefc3 /pym/gentoolkit/revdep_rebuild | |
parent | Merge branch 'master' of git+ssh://git.gentoo.org/proj/gentoolkit (diff) | |
download | gentoolkit-c8783ccb225cddb43052463c092e8edc091c371a.tar.gz gentoolkit-c8783ccb225cddb43052463c092e8edc091c371a.tar.bz2 gentoolkit-c8783ccb225cddb43052463c092e8edc091c371a.zip |
revdep-ebuild: Fix unicode argument expected error
Use the os module from portage to fix inconsistent returning of unicode
and str objects from listdir and explictly write the timestamp as
unicode.
X-Gentoo-bug: 589130
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=589130
Diffstat (limited to 'pym/gentoolkit/revdep_rebuild')
-rw-r--r-- | pym/gentoolkit/revdep_rebuild/cache.py | 8 | ||||
-rw-r--r-- | pym/gentoolkit/revdep_rebuild/collect.py | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/pym/gentoolkit/revdep_rebuild/cache.py b/pym/gentoolkit/revdep_rebuild/cache.py index 7359d05..e92e7cd 100644 --- a/pym/gentoolkit/revdep_rebuild/cache.py +++ b/pym/gentoolkit/revdep_rebuild/cache.py @@ -5,17 +5,19 @@ Functions for reading, saving and verifying the data caches from __future__ import print_function -import os +from portage import os import time import sys if sys.hexversion < 0x3000000: from io import open + _unicode = unicode +else: + _unicode = str from portage import _encodings, _unicode_decode, _unicode_encode from portage.output import red from .settings import DEFAULTS - def read_cache(temp_path=DEFAULTS['DEFAULT_TMP_DIR']): ''' Reads cache information needed by analyse function. This function does not checks if files exists nor timestamps, @@ -59,7 +61,7 @@ def save_cache(logger, to_save={}, temp_path=DEFAULTS['DEFAULT_TMP_DIR']): try: _file = open(_unicode_encode(os.path.join(temp_path, 'timestamp'), encoding=_encodings['fs']), mode='w', encoding=_encodings['content']) - _file.write(str(int(time.time()))) + _file.write(_unicode(int(time.time()))) _file.close() for key,val in to_save.items(): diff --git a/pym/gentoolkit/revdep_rebuild/collect.py b/pym/gentoolkit/revdep_rebuild/collect.py index ab3ef97..82cec7b 100644 --- a/pym/gentoolkit/revdep_rebuild/collect.py +++ b/pym/gentoolkit/revdep_rebuild/collect.py @@ -5,7 +5,7 @@ from __future__ import print_function import re -import os +from portage import os import glob import stat import sys |