From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 7F00413800E for ; Tue, 31 Jul 2012 17:52:07 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id DFB76E0138; Tue, 31 Jul 2012 17:51:49 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id ABAECE0138 for ; Tue, 31 Jul 2012 17:51:49 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id C12A21B4020 for ; Tue, 31 Jul 2012 17:51:48 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 839DBE5437 for ; Tue, 31 Jul 2012 17:51:47 +0000 (UTC) From: "André Erdmann" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "André Erdmann" Message-ID: <1343743055.847956c1d54647d0cfdbd9de2adc21d8404b82ff.dywi@gentoo> Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/ X-VCS-Repository: proj/R_overlay X-VCS-Files: roverlay/packageinfo.py X-VCS-Directories: roverlay/ X-VCS-Committer: dywi X-VCS-Committer-Name: André Erdmann X-VCS-Revision: 847956c1d54647d0cfdbd9de2adc21d8404b82ff X-VCS-Branch: master Date: Tue, 31 Jul 2012 17:51:47 +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: afad8641-445c-4a17-a28f-02b0008acd12 X-Archives-Hash: 0b12401a37e60076b5ffe35cd32b3d71 commit: 847956c1d54647d0cfdbd9de2adc21d8404b82ff Author: André Erdmann mailerd de> AuthorDate: Tue Jul 31 13:57:35 2012 +0000 Commit: André Erdmann mailerd de> CommitDate: Tue Jul 31 13:57:35 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=847956c1 PackageInfo.update: reduce if-checks use a simple_keys iterable to determine which key,value pairs can directly be used (self._info [key] = value) instead of an if-check per key. The logger message for unknown keys is a bit more accurate now. --- roverlay/packageinfo.py | 31 ++++++++++++++----------------- 1 files changed, 14 insertions(+), 17 deletions(-) diff --git a/roverlay/packageinfo.py b/roverlay/packageinfo.py index 731b62c..4514d4f 100644 --- a/roverlay/packageinfo.py +++ b/roverlay/packageinfo.py @@ -260,32 +260,29 @@ class PackageInfo ( object ): # nothing to do return + simple_keys = frozenset (( + 'origin', + 'desc_data', + 'ebuild', + 'ebuild_file', + 'physical_only', + 'src_uri' + )) + self._writelock_acquire() for key, value in info.items(): - if key == 'filename': + if key in simple_keys: + self [key] = value + + elif key == 'filename': self._use_filename ( value ) elif key == 'distdir': if value is not None: self ['distdir'] = value - elif key == 'origin': - self ['origin'] = value - - elif key == 'desc_data': - self ['desc_data'] = value - - elif key == 'ebuild': - self ['ebuild'] = value - - elif key == 'ebuild_file': - self ['ebuild_file'] = value - - elif key == 'physical_only': - self ['physical_only'] = value - elif key == 'pvr': self._use_pvr ( value ) @@ -309,7 +306,7 @@ class PackageInfo ( object ): self._remove_auto ( value ) else: - LOGGER.error ( "unknown info key {}!".format ( key ) ) + LOGGER.error ( "in update(): unknown info key {}!".format ( key ) ) self._update_lock.release() # --- end of update (**kw) ---