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

Function ExpandXcodeVariables

tools/gyp/pylib/gyp/generator/xcode.py:564–587  ·  view source on GitHub ↗

Expands Xcode-style $(VARIABLES) in string per the expansions dict. In some rare cases, it is appropriate to expand Xcode variables when a project file is generated. For any substring $(VAR) in string, if VAR is a key in the expansions dict, $(VAR) will be replaced with expansions[VAR]

(string, expansions)

Source from the content-addressed store, hash-verified

562
563
564def ExpandXcodeVariables(string, expansions):
565 """Expands Xcode-style $(VARIABLES) in string per the expansions dict.
566
567 In some rare cases, it is appropriate to expand Xcode variables when a
568 project file is generated. For any substring $(VAR) in string, if VAR is a
569 key in the expansions dict, $(VAR) will be replaced with expansions[VAR].
570 Any $(VAR) substring in string for which VAR is not a key in the expansions
571 dict will remain in the returned string.
572 """
573
574 matches = _xcode_variable_re.findall(string)
575 if matches is None:
576 return string
577
578 matches.reverse()
579 for match in matches:
580 (to_replace, variable) = match
581 if variable not in expansions:
582 continue
583
584 replacement = expansions[variable]
585 string = re.sub(re.escape(to_replace), replacement, string)
586
587 return string
588
589
590_xcode_define_re = re.compile(r"([\\\"\' ])")

Callers 1

GenerateOutputFunction · 0.85

Calls 1

escapeMethod · 0.45

Tested by

no test coverage detected