public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/packagerules/parser/context/
@ 2013-06-05 18:08 André Erdmann
  2013-06-13 16:34 ` [gentoo-commits] proj/R_overlay:master " André Erdmann
  0 siblings, 1 reply; 2+ messages in thread
From: André Erdmann @ 2013-06-05 18:08 UTC (permalink / raw
  To: gentoo-commits

commit:     69d3d6eebf2bd33fbb135be71004791a37f70ba1
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Jun  5 17:57:51 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Jun  5 17:57:51 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=69d3d6ee

package rule parser, set/rename: ActionInvalid

---
 roverlay/packagerules/parser/context/action.py | 45 ++++++++++++++++----------
 1 file changed, 28 insertions(+), 17 deletions(-)

diff --git a/roverlay/packagerules/parser/context/action.py b/roverlay/packagerules/parser/context/action.py
index c58f7ca..22936cc 100644
--- a/roverlay/packagerules/parser/context/action.py
+++ b/roverlay/packagerules/parser/context/action.py
@@ -14,14 +14,22 @@ import roverlay.packagerules.actions.relocate
 import roverlay.packagerules.actions.trace
 import roverlay.packagerules.parser.context.base
 
-class ActionUnknown ( ValueError ):
+class RuleActionException ( ValueError ):
+   pass
+# --- end of RuleActionException ---
+
+class ActionUnknown ( RuleActionException ):
    pass
 # --- end of ActionUnknown ---
 
-class ActionNeedsValue ( ValueError ):
+class ActionNeedsValue ( RuleActionException ):
    pass
 # --- end of ActionNeedsValue ---
 
+class ActionInvalid ( RuleActionException ):
+   pass
+# --- end of ActionInvalid ---
+
 
 class RuleActionContext (
    roverlay.packagerules.parser.context.base.BaseContext
@@ -50,18 +58,19 @@ class RuleActionContext (
    #
    DEFAULT_MODIFY_INFO_ACTIONS = (
       roverlay.packagerules.actions.info.InfoSetToAction,
-      roverlay.packagerules.actions.info.LazyInfoRenameAction
+      roverlay.packagerules.actions.info.InfoRenameAction,
    )
 
-   # dict { key => None | { None | SetTo_Action, None | Rename_Action }
-   #   where None is "use default action(s)"
+   # dict { key => None | ( None|False|SetTo_Action, None|False|Rename_Action )
+   #   where None  is "use default action(s)"
+   #   and   False is "invalid"/"not supported"
+   #
+   # (see comment in packageinfo.py concerning keys that exist when calling
+   #  apply_action() and enable lazy actions if necessary)
    #
    MODIFIABLE_INFO_KEYS = {
-      'name' : (
-         None,
-         roverlay.packagerules.actions.info.InfoRenameAction
-      ),
-      'category' : None,
+      'name'     : None,
+      'category' : ( None, False ),
       'destfile' : (
          None,
          roverlay.packagerules.actions.relocate.SrcDestRenameAction
@@ -141,17 +150,19 @@ class RuleActionContext (
 
          # ( ( cls_tuple or <default> ) [action_type] ) or <default>
          action_cls = (
-            (
-               self.MODIFIABLE_INFO_KEYS [key]
-               or self.DEFAULT_MODIFY_INFO_ACTIONS
-            ) [action_type]
-            or self.DEFAULT_MODIFY_INFO_ACTIONS [action_type]
-         )
+            self.MODIFIABLE_INFO_KEYS [key]
+            or self.DEFAULT_MODIFY_INFO_ACTIONS
+         ) [action_type]
+
+         if action_cls is None:
+            action_cls = self.DEFAULT_MODIFY_INFO_ACTIONS [action_type]
       except KeyError:
          raise ActionUnknown ( orig_str )
 
       # create and add action
-      if action_type == 0:
+      if action_cls is False:
+         raise ActionInvalid ( orig_str )
+      elif action_type == 0:
          # info action (1 arg)
          value = roverlay.strutil.unquote ( value )
 


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] proj/R_overlay:master commit in: roverlay/packagerules/parser/context/
  2013-06-05 18:08 [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/packagerules/parser/context/ André Erdmann
@ 2013-06-13 16:34 ` André Erdmann
  0 siblings, 0 replies; 2+ messages in thread
From: André Erdmann @ 2013-06-13 16:34 UTC (permalink / raw
  To: gentoo-commits

commit:     69d3d6eebf2bd33fbb135be71004791a37f70ba1
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Jun  5 17:57:51 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Jun  5 17:57:51 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=69d3d6ee

package rule parser, set/rename: ActionInvalid

---
 roverlay/packagerules/parser/context/action.py | 45 ++++++++++++++++----------
 1 file changed, 28 insertions(+), 17 deletions(-)

diff --git a/roverlay/packagerules/parser/context/action.py b/roverlay/packagerules/parser/context/action.py
index c58f7ca..22936cc 100644
--- a/roverlay/packagerules/parser/context/action.py
+++ b/roverlay/packagerules/parser/context/action.py
@@ -14,14 +14,22 @@ import roverlay.packagerules.actions.relocate
 import roverlay.packagerules.actions.trace
 import roverlay.packagerules.parser.context.base
 
-class ActionUnknown ( ValueError ):
+class RuleActionException ( ValueError ):
+   pass
+# --- end of RuleActionException ---
+
+class ActionUnknown ( RuleActionException ):
    pass
 # --- end of ActionUnknown ---
 
-class ActionNeedsValue ( ValueError ):
+class ActionNeedsValue ( RuleActionException ):
    pass
 # --- end of ActionNeedsValue ---
 
+class ActionInvalid ( RuleActionException ):
+   pass
+# --- end of ActionInvalid ---
+
 
 class RuleActionContext (
    roverlay.packagerules.parser.context.base.BaseContext
@@ -50,18 +58,19 @@ class RuleActionContext (
    #
    DEFAULT_MODIFY_INFO_ACTIONS = (
       roverlay.packagerules.actions.info.InfoSetToAction,
-      roverlay.packagerules.actions.info.LazyInfoRenameAction
+      roverlay.packagerules.actions.info.InfoRenameAction,
    )
 
-   # dict { key => None | { None | SetTo_Action, None | Rename_Action }
-   #   where None is "use default action(s)"
+   # dict { key => None | ( None|False|SetTo_Action, None|False|Rename_Action )
+   #   where None  is "use default action(s)"
+   #   and   False is "invalid"/"not supported"
+   #
+   # (see comment in packageinfo.py concerning keys that exist when calling
+   #  apply_action() and enable lazy actions if necessary)
    #
    MODIFIABLE_INFO_KEYS = {
-      'name' : (
-         None,
-         roverlay.packagerules.actions.info.InfoRenameAction
-      ),
-      'category' : None,
+      'name'     : None,
+      'category' : ( None, False ),
       'destfile' : (
          None,
          roverlay.packagerules.actions.relocate.SrcDestRenameAction
@@ -141,17 +150,19 @@ class RuleActionContext (
 
          # ( ( cls_tuple or <default> ) [action_type] ) or <default>
          action_cls = (
-            (
-               self.MODIFIABLE_INFO_KEYS [key]
-               or self.DEFAULT_MODIFY_INFO_ACTIONS
-            ) [action_type]
-            or self.DEFAULT_MODIFY_INFO_ACTIONS [action_type]
-         )
+            self.MODIFIABLE_INFO_KEYS [key]
+            or self.DEFAULT_MODIFY_INFO_ACTIONS
+         ) [action_type]
+
+         if action_cls is None:
+            action_cls = self.DEFAULT_MODIFY_INFO_ACTIONS [action_type]
       except KeyError:
          raise ActionUnknown ( orig_str )
 
       # create and add action
-      if action_type == 0:
+      if action_cls is False:
+         raise ActionInvalid ( orig_str )
+      elif action_type == 0:
          # info action (1 arg)
          value = roverlay.strutil.unquote ( value )
 


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-06-13 16:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-05 18:08 [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/packagerules/parser/context/ André Erdmann
2013-06-13 16:34 ` [gentoo-commits] proj/R_overlay:master " André Erdmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox