Mercurial > hg > pyloader
comparison pyloader/factory.py @ 44:be4fbf390e36
a bit of restructure
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Wed, 08 Jun 2011 18:13:17 -0700 |
parents | a45743b31c6f |
children | 7b145c3d2a16 |
comparison
equal
deleted
inserted
replaced
43:a45743b31c6f | 44:be4fbf390e36 |
---|---|
104 """interpret configuration from raw .ini syntax""" | 104 """interpret configuration from raw .ini syntax""" |
105 config = {} | 105 config = {} |
106 interpolated = set() | 106 interpolated = set() |
107 seen = set() | 107 seen = set() |
108 | 108 |
109 def create_section(section, options): | 109 # create a hash of section names |
110 names = {} | |
111 for section in iniconfig: | |
110 | 112 |
111 # sanity check | 113 # sanity check |
112 assert ':' in section, "No : in section: %s" % section | 114 assert ':' in section, "No : in section: %s" % section |
113 | 115 |
114 # make a dict for the section | 116 |
117 def create_section(section, options): | |
118 | |
119 # split up the section identifier | |
115 name, path = section.split(':', 1) | 120 name, path = section.split(':', 1) |
116 | 121 |
117 # interpret decorators | 122 # interpret decorators |
118 if ':' in path: | 123 if ':' in path: |
119 wrapper, _path = path.split(':', 1) | 124 wrapper, _path = path.split(':', 1) |
120 # TODO: could interpolate wrapper | 125 # TODO: could interpolate wrapper |
121 if wrapper in iniconfig: | 126 if wrapper in iniconfig: |
122 | 127 |
123 path = _path | 128 path = _path |
124 | 129 |
130 # make a dict for the section | |
125 path = path % defaults | 131 path = path % defaults |
126 sect = config[name] = dict(path=path) | 132 sect = config[name] = dict(path=path) |
127 | 133 |
134 # get arguments from .ini options | |
128 for option, value in options.items(): | 135 for option, value in options.items(): |
129 | 136 |
130 if option == '.': # positional arguments | 137 if option == '.': # positional arguments |
131 sect['args'] = cast.str2list(value) | 138 sect['args'] = cast.str2list(value) |
132 else: | 139 else: |