The rule for checking toolset parameters. Trailing parameters should all be parameter name/value pairs. The rule will check that each parameter either has a value in each invocation or has no value in each invocation. Also, the rule will check that the combination of all par
(toolset, requirement, *args)
| 158 | |
| 159 | # Ported from trunk@47174 |
| 160 | def check_init_parameters(toolset, requirement, *args): |
| 161 | """ The rule for checking toolset parameters. Trailing parameters should all be |
| 162 | parameter name/value pairs. The rule will check that each parameter either has |
| 163 | a value in each invocation or has no value in each invocation. Also, the rule |
| 164 | will check that the combination of all parameter values is unique in all |
| 165 | invocations. |
| 166 | |
| 167 | Each parameter name corresponds to a subfeature. This rule will declare a |
| 168 | subfeature the first time a non-empty parameter value is passed and will |
| 169 | extend it with all the values. |
| 170 | |
| 171 | The return value from this rule is a condition to be used for flags settings. |
| 172 | """ |
| 173 | # The type checking here is my best guess about |
| 174 | # what the types should be. |
| 175 | assert(isinstance(toolset, str)) |
| 176 | assert(isinstance(requirement, str) or requirement is None) |
| 177 | sig = toolset |
| 178 | condition = replace_grist(toolset, '<toolset>') |
| 179 | subcondition = [] |
| 180 | |
| 181 | for arg in args: |
| 182 | assert(isinstance(arg, tuple)) |
| 183 | assert(len(arg) == 2) |
| 184 | name = arg[0] |
| 185 | value = arg[1] |
| 186 | assert(isinstance(name, str)) |
| 187 | assert(isinstance(value, str) or value is None) |
| 188 | |
| 189 | str_toolset_name = str((toolset, name)) |
| 190 | |
| 191 | # FIXME: is this the correct translation? |
| 192 | ### if $(value)-is-not-empty |
| 193 | if value is not None: |
| 194 | condition = condition + '-' + value |
| 195 | if __had_unspecified_value.has_key(str_toolset_name): |
| 196 | raise BaseException("'%s' initialization: parameter '%s' inconsistent\n" \ |
| 197 | "no value was specified in earlier initialization\n" \ |
| 198 | "an explicit value is specified now" % (toolset, name)) |
| 199 | |
| 200 | # The logic below is for intel compiler. It calls this rule |
| 201 | # with 'intel-linux' and 'intel-win' as toolset, so we need to |
| 202 | # get the base part of toolset name. |
| 203 | # We can't pass 'intel' as toolset, because it that case it will |
| 204 | # be impossible to register versionles intel-linux and |
| 205 | # intel-win of specific version. |
| 206 | t = toolset |
| 207 | m = __re__before_first_dash.match(toolset) |
| 208 | if m: |
| 209 | t = m.group(1) |
| 210 | |
| 211 | if not __had_value.has_key(str_toolset_name): |
| 212 | if not __declared_subfeature.has_key(str((t, name))): |
| 213 | feature.subfeature('toolset', t, name, [], ['propagated']) |
| 214 | __declared_subfeature[str((t, name))] = True |
| 215 | |
| 216 | __had_value[str_toolset_name] = True |
| 217 |
nothing calls this directly
no test coverage detected