12 """Extracts necessary piece of the buildfile. Returns empty 13 string if not found.""" 15 build = open (buildfile,
'r') 17 raise RuntimeError(
"Could not open BuildFile '%s' for reading. Aboring." \
20 startBinRE = re.compile (
r'<\s*bin\s+name=(\S+)')
21 endBinRE = re.compile (
r'<\s*/bin>')
22 exeNameRE = re.compile (
r'(\w+)\.exe')
23 ccName = os.path.basename (copy)
24 match = ccRE.match (ccName)
26 ccName = match.group (1)
34 if foundBin
and endBinRE.search (line):
38 match = startBinRE.search (line)
41 exeName = match.group (1)
42 exeMatch = exeNameRE.search (exeName)
44 exeName = exeMatch.group (1)
47 line = re.sub (exeName, target, line)
def extractBuildFilePiece(buildfile, copy, target='dummy')