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 1BE241393DD for ; Fri, 18 Jul 2014 16:20:06 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8B355E093A; Fri, 18 Jul 2014 16:20:05 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id DA621E093A for ; Fri, 18 Jul 2014 16:20:04 +0000 (UTC) Received: from spoonbill.gentoo.org (spoonbill.gentoo.org [81.93.255.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id B5A453403CF for ; Fri, 18 Jul 2014 16:20:03 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by spoonbill.gentoo.org (Postfix) with ESMTP id 73C46193EA for ; Fri, 18 Jul 2014 16:20:01 +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: <1405624461.093b182951ad7ab6eb7e519061c7b95dc218aacb.dywi@gentoo> Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/ X-VCS-Repository: proj/R_overlay X-VCS-Files: roverlay/overlay/abccontrol.py X-VCS-Directories: roverlay/overlay/ X-VCS-Committer: dywi X-VCS-Committer-Name: André Erdmann X-VCS-Revision: 093b182951ad7ab6eb7e519061c7b95dc218aacb X-VCS-Branch: master Date: Fri, 18 Jul 2014 16:20:01 +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: fb8ffb14-8943-4193-89b8-f97b769952ba X-Archives-Hash: cbea8ac0db6ec812b5365ecf4ff404b4 commit: 093b182951ad7ab6eb7e519061c7b95dc218aacb Author: André Erdmann mailerd de> AuthorDate: Thu Jul 17 19:14:21 2014 +0000 Commit: André Erdmann mailerd de> CommitDate: Thu Jul 17 19:14:21 2014 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=093b1829 overlay/abccontrol: convert_str() --- roverlay/overlay/abccontrol.py | 42 +++++++++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/roverlay/overlay/abccontrol.py b/roverlay/overlay/abccontrol.py index 364a083..d031eec 100644 --- a/roverlay/overlay/abccontrol.py +++ b/roverlay/overlay/abccontrol.py @@ -82,17 +82,37 @@ class AdditionControlResult ( object ): ) = _gen_bits(5) -# PKG_DESCRIPTION_MAP = { -# PKG_FORCE_DENY : 'force-deny', -# PKG_DENY_REPLACE : 'deny-replace', -# PKG_FORCE_REPLACE : 'force-replace', -# PKG_REPLACE_ONLY : 'replace-only', -# PKG_REVBUMP_ON_COLLISION : 'revbump-on-collision', -# PKG_DEFAULT_BEHAVIOR : 'default', -# } -# -# PKG_DESCRIPTION_REVMAP = { v: k for k,v in PKG_DESCRIPTION_MAP.items() } -# + PKG_DESCRIPTION_MAP = { + PKG_FORCE_DENY : 'force-deny', + PKG_DENY_REPLACE : 'deny-replace', + PKG_FORCE_REPLACE : 'force-replace', + PKG_REPLACE_ONLY : 'replace-only', + PKG_REVBUMP_ON_COLLISION : 'revbump-on-collision', + PKG_DEFAULT_BEHAVIOR : 'default', + } + + PKG_DESCRIPTION_REVMAP = { v: k for k,v in PKG_DESCRIPTION_MAP.items() } + + @classmethod + def convert_str ( cls, s ): + desc_rmap = cls.PKG_DESCRIPTION_REVMAP + + if not s: + raise ValueError ( "str must not be empty." ) + + bitmask = 0 + + for arg in filter ( None, s.strip().lower().split(",") ): + # ^ strip(),lower(),split() ... + print(arg) + try: + bitmask |= desc_rmap [arg] + except KeyError: + raise ValueError ( arg ) + # -- end for + + return bitmask + # --- end of convert_str (...) --- @classmethod def get_reversed_sort_key ( cls, k ): 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 95AE21393DD for ; Thu, 17 Jul 2014 20:12:36 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 39A8AE0995; Thu, 17 Jul 2014 20:12:34 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 462A6E0986 for ; Thu, 17 Jul 2014 20:12:33 +0000 (UTC) Received: from spoonbill.gentoo.org (spoonbill.gentoo.org [81.93.255.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 3A099340307 for ; Thu, 17 Jul 2014 20:12:32 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by spoonbill.gentoo.org (Postfix) with ESMTP id 39D23193E7 for ; Thu, 17 Jul 2014 20:12:29 +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: <1405624461.093b182951ad7ab6eb7e519061c7b95dc218aacb.dywi@gentoo> Subject: [gentoo-commits] proj/R_overlay:wip/addition_control commit in: roverlay/overlay/ X-VCS-Repository: proj/R_overlay X-VCS-Files: roverlay/overlay/abccontrol.py X-VCS-Directories: roverlay/overlay/ X-VCS-Committer: dywi X-VCS-Committer-Name: André Erdmann X-VCS-Revision: 093b182951ad7ab6eb7e519061c7b95dc218aacb X-VCS-Branch: wip/addition_control Date: Thu, 17 Jul 2014 20:12:29 +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: 4bd126cd-1b0b-4ecd-89c4-8c33dd043cd8 X-Archives-Hash: 59902d9d7832cc72b352811cc34e3796 Message-ID: <20140717201229.xifLSCcmNUvwPTzzBUTgqhTxVLhJikzRHaOMxPBBSKM@z> commit: 093b182951ad7ab6eb7e519061c7b95dc218aacb Author: André Erdmann mailerd de> AuthorDate: Thu Jul 17 19:14:21 2014 +0000 Commit: André Erdmann mailerd de> CommitDate: Thu Jul 17 19:14:21 2014 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=093b1829 overlay/abccontrol: convert_str() --- roverlay/overlay/abccontrol.py | 42 +++++++++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/roverlay/overlay/abccontrol.py b/roverlay/overlay/abccontrol.py index 364a083..d031eec 100644 --- a/roverlay/overlay/abccontrol.py +++ b/roverlay/overlay/abccontrol.py @@ -82,17 +82,37 @@ class AdditionControlResult ( object ): ) = _gen_bits(5) -# PKG_DESCRIPTION_MAP = { -# PKG_FORCE_DENY : 'force-deny', -# PKG_DENY_REPLACE : 'deny-replace', -# PKG_FORCE_REPLACE : 'force-replace', -# PKG_REPLACE_ONLY : 'replace-only', -# PKG_REVBUMP_ON_COLLISION : 'revbump-on-collision', -# PKG_DEFAULT_BEHAVIOR : 'default', -# } -# -# PKG_DESCRIPTION_REVMAP = { v: k for k,v in PKG_DESCRIPTION_MAP.items() } -# + PKG_DESCRIPTION_MAP = { + PKG_FORCE_DENY : 'force-deny', + PKG_DENY_REPLACE : 'deny-replace', + PKG_FORCE_REPLACE : 'force-replace', + PKG_REPLACE_ONLY : 'replace-only', + PKG_REVBUMP_ON_COLLISION : 'revbump-on-collision', + PKG_DEFAULT_BEHAVIOR : 'default', + } + + PKG_DESCRIPTION_REVMAP = { v: k for k,v in PKG_DESCRIPTION_MAP.items() } + + @classmethod + def convert_str ( cls, s ): + desc_rmap = cls.PKG_DESCRIPTION_REVMAP + + if not s: + raise ValueError ( "str must not be empty." ) + + bitmask = 0 + + for arg in filter ( None, s.strip().lower().split(",") ): + # ^ strip(),lower(),split() ... + print(arg) + try: + bitmask |= desc_rmap [arg] + except KeyError: + raise ValueError ( arg ) + # -- end for + + return bitmask + # --- end of convert_str (...) --- @classmethod def get_reversed_sort_key ( cls, k ):