13 """Extracts necessary piece of the buildfile. Returns empty 14 string if not found.""" 16 build = open (buildfile,
'r') 18 raise RuntimeError(
"Could not open BuildFile '%s' for reading. Aboring." \
21 startBinRE = re.compile (
r'<\s*bin\s+name=(\S+)')
22 endBinRE = re.compile (
r'<\s*/bin>')
23 exeNameRE = re.compile (
r'(\w+)\.exe')
24 ccName = os.path.basename (copy)
25 match = ccRE.match (ccName)
27 ccName = match.group (1)
35 if foundBin
and endBinRE.search (line):
39 match = startBinRE.search (line)
42 exeName = match.group (1)
43 exeMatch = exeNameRE.search (exeName)
45 exeName = exeMatch.group (1)
48 line = re.sub (exeName, target, line)
def extractBuildFilePiece(buildfile, copy, target='dummy')