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

Function getmakevars

Tools/freeze/parsesetup.py:12–38  ·  view source on GitHub ↗
(filename)

Source from the content-addressed store, hash-verified

10makevardef = re.compile('^([a-zA-Z0-9_]+)[ \t]*=(.*)')
11
12def getmakevars(filename):
13 variables = {}
14 fp = open(filename)
15 pendingline = ""
16 try:
17 while 1:
18 line = fp.readline()
19 if pendingline:
20 line = pendingline + line
21 pendingline = ""
22 if not line:
23 break
24 if line.endswith('\\\n'):
25 pendingline = line[:-2]
26 matchobj = makevardef.match(line)
27 if not matchobj:
28 continue
29 (name, value) = matchobj.group(1, 2)
30 # Strip trailing comment
31 i = value.find('#')
32 if i >= 0:
33 value = value[:i]
34 value = value.strip()
35 variables[name] = value
36 finally:
37 fp.close()
38 return variables
39
40
41# Parse a Python Setup(.in) file.

Callers 1

testFunction · 0.85

Calls 8

openFunction · 0.70
readlineMethod · 0.45
endswithMethod · 0.45
matchMethod · 0.45
groupMethod · 0.45
findMethod · 0.45
stripMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…