MCPcopy Index your code
hub / github.com/python/cpython / grepValue

Function grepValue

Mac/BuildScript/build-installer.py:73–84  ·  view source on GitHub ↗

Return the unquoted value of a variable from a file.. QUOTED_VALUE='quotes' -> str('quotes') UNQUOTED_VALUE=noquotes -> str('noquotes')

(fn, variable)

Source from the content-addressed store, hash-verified

71 return "'%s'"%(value.replace("'", "'\"'\"'"))
72
73def grepValue(fn, variable):
74 """
75 Return the unquoted value of a variable from a file..
76 QUOTED_VALUE='quotes' -> str('quotes')
77 UNQUOTED_VALUE=noquotes -> str('noquotes')
78 """
79 variable = variable + '='
80 for ln in open(fn, 'r'):
81 if ln.startswith(variable):
82 value = ln[len(variable):].strip()
83 return value.strip("\"'")
84 raise RuntimeError("Cannot find variable %s" % variable[:-1])
85
86_cache_getVersion = None
87

Callers 3

getVersionFunction · 0.85
build_universal_opensslFunction · 0.85
buildPythonFunction · 0.85

Calls 3

openFunction · 0.50
startswithMethod · 0.45
stripMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…