From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id A86BA13832E for ; Mon, 15 Aug 2016 21:06:20 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A41DF21C038; Mon, 15 Aug 2016 21:06:16 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 4A37D21C038 for ; Mon, 15 Aug 2016 21:06:16 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 18DF0340E11 for ; Mon, 15 Aug 2016 21:06:15 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id AE36E2457 for ; Mon, 15 Aug 2016 21:06:13 +0000 (UTC) From: "Paul Varner" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Paul Varner" Message-ID: <1471294923.c8783ccb225cddb43052463c092e8edc091c371a.fuzzyray@gentoo> Subject: [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/revdep_rebuild/ X-VCS-Repository: proj/gentoolkit X-VCS-Files: pym/gentoolkit/revdep_rebuild/cache.py pym/gentoolkit/revdep_rebuild/collect.py X-VCS-Directories: pym/gentoolkit/revdep_rebuild/ X-VCS-Committer: fuzzyray X-VCS-Committer-Name: Paul Varner X-VCS-Revision: c8783ccb225cddb43052463c092e8edc091c371a X-VCS-Branch: master Date: Mon, 15 Aug 2016 21:06:13 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 2c4bcfb8-ce91-4d43-b48d-e89c3a159673 X-Archives-Hash: da41c2a116810ffc072d6592bd70abe2 commit: c8783ccb225cddb43052463c092e8edc091c371a Author: Paul Varner gentoo org> AuthorDate: Mon Aug 15 21:02:03 2016 +0000 Commit: Paul Varner gentoo org> CommitDate: Mon Aug 15 21:02:03 2016 +0000 URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=c8783ccb 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 pym/gentoolkit/revdep_rebuild/cache.py | 8 +++++--- 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