MCPcopy Create free account
hub / github.com/nodejs/node / _EscapeEnvironmentVariableExpansion

Function _EscapeEnvironmentVariableExpansion

tools/gyp/pylib/gyp/generator/msvs.py:741–756  ·  view source on GitHub ↗

Escapes % characters. Escapes any % characters so that Windows-style environment variable expansions will leave them alone. See http://connect.microsoft.com/VisualStudio/feedback/details/106127/cl-d-name-text-containing-percentage-characters-doesnt-compile to understand why we have

(s)

Source from the content-addressed store, hash-verified

739
740
741def _EscapeEnvironmentVariableExpansion(s):
742 """Escapes % characters.
743
744 Escapes any % characters so that Windows-style environment variable
745 expansions will leave them alone.
746 See http://connect.microsoft.com/VisualStudio/feedback/details/106127/cl-d-name-text-containing-percentage-characters-doesnt-compile
747 to understand why we have to do this.
748
749 Args:
750 s: The string to be escaped.
751
752 Returns:
753 The escaped string.
754 """
755 s = s.replace("%", "%%")
756 return s
757
758
759quote_replacer_regex = re.compile(r'(\\*)"')

Callers 2

_EscapeCppDefineForMSVSFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected