MCPcopy Index your code
hub / github.com/nodejs/node / ProcessConditionsInDict

Function ProcessConditionsInDict

tools/gyp/pylib/gyp/input.py:1200–1245  ·  view source on GitHub ↗
(the_dict, phase, variables, build_file)

Source from the content-addressed store, hash-verified

1198
1199
1200def ProcessConditionsInDict(the_dict, phase, variables, build_file):
1201 # Process a 'conditions' or 'target_conditions' section in the_dict,
1202 # depending on phase.
1203 # early -> conditions
1204 # late -> target_conditions
1205 # latelate -> no conditions
1206 #
1207 # Each item in a conditions list consists of cond_expr, a string expression
1208 # evaluated as the condition, and true_dict, a dict that will be merged into
1209 # the_dict if cond_expr evaluates to true. Optionally, a third item,
1210 # false_dict, may be present. false_dict is merged into the_dict if
1211 # cond_expr evaluates to false.
1212 #
1213 # Any dict merged into the_dict will be recursively processed for nested
1214 # conditionals and other expansions, also according to phase, immediately
1215 # prior to being merged.
1216
1217 if phase == PHASE_EARLY:
1218 conditions_key = "conditions"
1219 elif phase == PHASE_LATE:
1220 conditions_key = "target_conditions"
1221 elif phase == PHASE_LATELATE:
1222 return
1223 else:
1224 assert False
1225
1226 if conditions_key not in the_dict:
1227 return
1228
1229 conditions_list = the_dict[conditions_key]
1230 # Unhook the conditions list, it's no longer needed.
1231 del the_dict[conditions_key]
1232
1233 for condition in conditions_list:
1234 merge_dict = EvalCondition(
1235 condition, conditions_key, phase, variables, build_file
1236 )
1237
1238 if merge_dict is not None:
1239 # Expand variables and nested conditionals in the merge_dict before
1240 # merging it.
1241 ProcessVariablesAndConditionsInDict(
1242 merge_dict, phase, variables, build_file
1243 )
1244
1245 MergeDicts(the_dict, merge_dict, build_file, build_file)
1246
1247
1248def LoadAutomaticVariablesFromDict(variables, the_dict):

Callers 1

Calls 3

EvalConditionFunction · 0.85
MergeDictsFunction · 0.85

Tested by

no test coverage detected