blob: ec72f1d47ea4a07752fcb34bc5e912b3047932df [file] [log] [blame]
# Copyright (c) 2019 Refael Ackeramnn<>. All rights reserved.
# Use of this source code is governed by an MIT-style license.
import re
import os
PLAIN_SOURCE_RE = re.compile('\s*"([^/$].+)"\s*')
def DoMain(args):
gn_filename, pattern = args
src_root = os.path.dirname(gn_filename)
with open(gn_filename, 'rb') as gn_file:
gn_content ='utf-8')
scraper_re = re.compile(pattern + r'\[([^\]]+)', re.DOTALL)
matches =
match =
files = []
for l in match.splitlines():
m2 = PLAIN_SOURCE_RE.match(l)
if not m2:
# always use `/` since GYP will process paths further downstream
rel_files = ['"%s/%s"' % (src_root, f) for f in files]
return ' '.join(rel_files)