MCPcopy Index your code
hub / github.com/nodejs/node / DoMain

Function DoMain

tools/v8_gypfiles/GN-scraper.py:8–25  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

6
7PLAIN_SOURCE_RE = re.compile(r'\s*"([^/$].+)"\s*')
8def DoMain(args):
9 gn_filename, pattern = args
10 src_root = os.path.dirname(gn_filename)
11 with open(gn_filename, 'rb') as gn_file:
12 gn_content = gn_file.read().decode('utf-8')
13
14 scraper_re = re.compile(pattern + r'\[([^\]]+)', re.DOTALL)
15 matches = scraper_re.search(gn_content)
16 match = matches.group(1)
17 files = []
18 for l in match.splitlines():
19 m2 = PLAIN_SOURCE_RE.match(l)
20 if not m2:
21 continue
22 files.append(m2.group(1))
23 # always use `/` since GYP will process paths further downstream
24 rel_files = ['"%s/%s"' % (src_root, f) for f in files]
25 return ' '.join(rel_files)
26
27if __name__ == '__main__':
28 print(DoMain(sys.argv[1:]))

Callers 1

GN-scraper.pyFile · 0.70

Calls 9

decodeMethod · 0.65
matchMethod · 0.65
openFunction · 0.50
readMethod · 0.45
compileMethod · 0.45
searchMethod · 0.45
splitlinesMethod · 0.45
appendMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…