1 |
commit: 37545b5c22386e42805c644bab9c2ea7952ccf17 |
2 |
Author: André Erdmann <dywi <AT> mailerd <DOT> de> |
3 |
AuthorDate: Thu Aug 2 14:57:04 2012 +0000 |
4 |
Commit: André Erdmann <dywi <AT> mailerd <DOT> de> |
5 |
CommitDate: Thu Aug 2 14:57:04 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=37545b5c |
7 |
|
8 |
config: update entry map comment |
9 |
|
10 |
--- |
11 |
roverlay/config/entrymap.py | 15 +++++---------- |
12 |
roverlay/config/tree.py | 19 +++++++------------ |
13 |
2 files changed, 12 insertions(+), 22 deletions(-) |
14 |
|
15 |
diff --git a/roverlay/config/entrymap.py b/roverlay/config/entrymap.py |
16 |
index 078ddfe..0119983 100644 |
17 |
--- a/roverlay/config/entrymap.py |
18 |
+++ b/roverlay/config/entrymap.py |
19 |
@@ -1,6 +1,4 @@ |
20 |
-# <header!!> |
21 |
- |
22 |
-# TODO/FIXME comments |
23 |
+# R Overlay -- config entry map |
24 |
|
25 |
# the map of config entries (keep keys in lowercase) |
26 |
# format is config_entry = None|''|str|dict(...), where |
27 |
@@ -10,10 +8,10 @@ |
28 |
# dict() means that config_entry has options / diverts from defaults. |
29 |
# |
30 |
# known dict keys are: |
31 |
-# * path = str | list of str -- path of this entry in the config tree |
32 |
+# * path = str | list of str -- path of this entry in the config tree |
33 |
+# * description = str -- description |
34 |
# |
35 |
# * value_type, you can specify: |
36 |
-# ** slist -- value is a whitespace-separated list (replaced by list) |
37 |
# ** list -- value is a whitespace-separated list |
38 |
# ** int -- integer |
39 |
# ** str -- [explicit string conversion] |
40 |
@@ -23,14 +21,13 @@ |
41 |
# (pwd + path) |
42 |
# ** fs_dir -- fs_abs and value must be a dir if it exists |
43 |
# ** fs_file -- fs_abs and value must be a file if it exists |
44 |
-# TODO** fs_prog -- fs_file (and fs_path) and value must be executable (TODO) |
45 |
# ** regex -- value is a regex and will be compiled (re.compile(..)) |
46 |
# |
47 |
# multiple types are generally not supported ('this is an int or a str'), |
48 |
# but subtypes are ('list of yesno'), which can be specified by either |
49 |
# using a list of types ['list', 'yesno'] or by separating the types |
50 |
# with a colon 'list:yesno', which is parsed in a left-to-right order. |
51 |
-# Nested subtypes such as list:slist:int:fs_file:list may lead to errors. |
52 |
+# Nested subtypes such as list:int:fs_file:list may lead to errors. |
53 |
# |
54 |
|
55 |
fs_file = 'fs_file' |
56 |
@@ -173,7 +170,7 @@ CONFIG_ENTRY_MAP = dict ( |
57 |
|
58 |
# == overlay == |
59 |
|
60 |
- # FIXME key is not in use |
61 |
+ # COULDFIX key is not in use |
62 |
ebuild_header = dict ( |
63 |
value_type = fs_file, |
64 |
description = '''NOT IN USE. |
65 |
@@ -312,5 +309,3 @@ def prune_description(): |
66 |
del entry ['description'] |
67 |
elif 'desc' in entry: |
68 |
del entry ['desc'] |
69 |
- |
70 |
- |
71 |
|
72 |
diff --git a/roverlay/config/tree.py b/roverlay/config/tree.py |
73 |
index dd14fb7..dfc6289 100644 |
74 |
--- a/roverlay/config/tree.py |
75 |
+++ b/roverlay/config/tree.py |
76 |
@@ -59,21 +59,16 @@ class ConfigTree ( object ): |
77 |
|
78 |
# strategy = theirs |
79 |
# unsafe operation (empty values,...) |
80 |
- if not _dict: |
81 |
- pass |
82 |
+ if _dict and isinstance ( _dict, dict ): |
83 |
|
84 |
- elif not isinstance ( _dict, dict ): |
85 |
- raise Exception ( "bad usage" ) |
86 |
+ u = { k : v for ( k, v ) in _dict.items() if v or v == 0 } |
87 |
+ merge_dict ( self._config, u ) |
88 |
|
89 |
- else: |
90 |
- if sys.version_info >= ( 2, 7 ): |
91 |
- u = { k : v for ( k, v ) in _dict.items() if v or v == 0 } |
92 |
- else: |
93 |
- # FIXME remove < 2.7 statement, roverlay (probably) doesn't work |
94 |
- # with python version prior to 2.7 |
95 |
- u = dict ( kv for kv in _dict.items() if kv [1] or kv [1] == 0 ) |
96 |
+ elif not _dict: |
97 |
+ pass |
98 |
|
99 |
- merge_dict ( self._config, u ) |
100 |
+ else: |
101 |
+ raise Exception ( "bad usage" ) |
102 |
|
103 |
# --- end of merge_with (...) --- |