Gentoo Archives: gentoo-commits

From: "André Erdmann" <dywi@×××××××.de>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/packagerules/parser/context/
Date: Wed, 05 Jun 2013 18:08:49
Message-Id: 1370455071.69d3d6eebf2bd33fbb135be71004791a37f70ba1.dywi@gentoo
1 commit: 69d3d6eebf2bd33fbb135be71004791a37f70ba1
2 Author: André Erdmann <dywi <AT> mailerd <DOT> de>
3 AuthorDate: Wed Jun 5 17:57:51 2013 +0000
4 Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
5 CommitDate: Wed Jun 5 17:57:51 2013 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=69d3d6ee
7
8 package rule parser, set/rename: ActionInvalid
9
10 ---
11 roverlay/packagerules/parser/context/action.py | 45 ++++++++++++++++----------
12 1 file changed, 28 insertions(+), 17 deletions(-)
13
14 diff --git a/roverlay/packagerules/parser/context/action.py b/roverlay/packagerules/parser/context/action.py
15 index c58f7ca..22936cc 100644
16 --- a/roverlay/packagerules/parser/context/action.py
17 +++ b/roverlay/packagerules/parser/context/action.py
18 @@ -14,14 +14,22 @@ import roverlay.packagerules.actions.relocate
19 import roverlay.packagerules.actions.trace
20 import roverlay.packagerules.parser.context.base
21
22 -class ActionUnknown ( ValueError ):
23 +class RuleActionException ( ValueError ):
24 + pass
25 +# --- end of RuleActionException ---
26 +
27 +class ActionUnknown ( RuleActionException ):
28 pass
29 # --- end of ActionUnknown ---
30
31 -class ActionNeedsValue ( ValueError ):
32 +class ActionNeedsValue ( RuleActionException ):
33 pass
34 # --- end of ActionNeedsValue ---
35
36 +class ActionInvalid ( RuleActionException ):
37 + pass
38 +# --- end of ActionInvalid ---
39 +
40
41 class RuleActionContext (
42 roverlay.packagerules.parser.context.base.BaseContext
43 @@ -50,18 +58,19 @@ class RuleActionContext (
44 #
45 DEFAULT_MODIFY_INFO_ACTIONS = (
46 roverlay.packagerules.actions.info.InfoSetToAction,
47 - roverlay.packagerules.actions.info.LazyInfoRenameAction
48 + roverlay.packagerules.actions.info.InfoRenameAction,
49 )
50
51 - # dict { key => None | { None | SetTo_Action, None | Rename_Action }
52 - # where None is "use default action(s)"
53 + # dict { key => None | ( None|False|SetTo_Action, None|False|Rename_Action )
54 + # where None is "use default action(s)"
55 + # and False is "invalid"/"not supported"
56 + #
57 + # (see comment in packageinfo.py concerning keys that exist when calling
58 + # apply_action() and enable lazy actions if necessary)
59 #
60 MODIFIABLE_INFO_KEYS = {
61 - 'name' : (
62 - None,
63 - roverlay.packagerules.actions.info.InfoRenameAction
64 - ),
65 - 'category' : None,
66 + 'name' : None,
67 + 'category' : ( None, False ),
68 'destfile' : (
69 None,
70 roverlay.packagerules.actions.relocate.SrcDestRenameAction
71 @@ -141,17 +150,19 @@ class RuleActionContext (
72
73 # ( ( cls_tuple or <default> ) [action_type] ) or <default>
74 action_cls = (
75 - (
76 - self.MODIFIABLE_INFO_KEYS [key]
77 - or self.DEFAULT_MODIFY_INFO_ACTIONS
78 - ) [action_type]
79 - or self.DEFAULT_MODIFY_INFO_ACTIONS [action_type]
80 - )
81 + self.MODIFIABLE_INFO_KEYS [key]
82 + or self.DEFAULT_MODIFY_INFO_ACTIONS
83 + ) [action_type]
84 +
85 + if action_cls is None:
86 + action_cls = self.DEFAULT_MODIFY_INFO_ACTIONS [action_type]
87 except KeyError:
88 raise ActionUnknown ( orig_str )
89
90 # create and add action
91 - if action_type == 0:
92 + if action_cls is False:
93 + raise ActionInvalid ( orig_str )
94 + elif action_type == 0:
95 # info action (1 arg)
96 value = roverlay.strutil.unquote ( value )