(the_list, phase, variables, build_file)
| 1399 | |
| 1400 | |
| 1401 | def ProcessVariablesAndConditionsInList(the_list, phase, variables, build_file): |
| 1402 | # Iterate using an index so that new values can be assigned into the_list. |
| 1403 | index = 0 |
| 1404 | while index < len(the_list): |
| 1405 | item = the_list[index] |
| 1406 | if isinstance(item, dict): |
| 1407 | # Make a copy of the variables dict so that it won't influence anything |
| 1408 | # outside of its own scope. |
| 1409 | ProcessVariablesAndConditionsInDict(item, phase, variables, build_file) |
| 1410 | elif isinstance(item, list): |
| 1411 | ProcessVariablesAndConditionsInList(item, phase, variables, build_file) |
| 1412 | elif isinstance(item, str): |
| 1413 | expanded = ExpandVariables(item, phase, variables, build_file) |
| 1414 | if type(expanded) in (str, int): |
| 1415 | the_list[index] = expanded |
| 1416 | elif isinstance(expanded, list): |
| 1417 | the_list[index : index + 1] = expanded |
| 1418 | index += len(expanded) |
| 1419 | |
| 1420 | # index now identifies the next item to examine. Continue right now |
| 1421 | # without falling into the index increment below. |
| 1422 | continue |
| 1423 | else: |
| 1424 | raise ValueError( |
| 1425 | "Variable expansion in this context permits strings and " |
| 1426 | + "lists only, found " |
| 1427 | + expanded.__class__.__name__ |
| 1428 | + " at " |
| 1429 | + index |
| 1430 | ) |
| 1431 | elif not isinstance(item, int): |
| 1432 | raise TypeError( |
| 1433 | "Unknown type " + item.__class__.__name__ + " at index " + index |
| 1434 | ) |
| 1435 | index = index + 1 |
| 1436 | |
| 1437 | |
| 1438 | def BuildTargetsDict(data): |
no test coverage detected
searching dependent graphs…