summaryrefslogtreecommitdiffstats
path: root/blimp/tools/generate-engine-manifest.py
diff options
context:
space:
mode:
Diffstat (limited to 'blimp/tools/generate-engine-manifest.py')
-rwxr-xr-xblimp/tools/generate-engine-manifest.py22
1 files changed, 19 insertions, 3 deletions
diff --git a/blimp/tools/generate-engine-manifest.py b/blimp/tools/generate-engine-manifest.py
index 0c5c90c..f8e70bb 100755
--- a/blimp/tools/generate-engine-manifest.py
+++ b/blimp/tools/generate-engine-manifest.py
@@ -9,11 +9,17 @@
import argparse
import errno
+import fnmatch
import os
import subprocess
import sys
import tarfile
+# Returns True if |entry| matches any of the patterns in |blacklist|.
+def IsBlacklisted(entry, blacklist):
+ return any([next_pat for next_pat in blacklist
+ if fnmatch.fnmatch(entry, next_pat)])
+
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--build-dir',
@@ -31,7 +37,7 @@ def main():
try:
deps = subprocess.check_output(['gn', 'desc', args.build_dir, args.target,
- 'runtime_deps'])
+ 'runtime_deps']).split()
except subprocess.CalledProcessError as e:
print "Error: " + ' '.join(e.cmd)
print e.output
@@ -44,12 +50,22 @@ def main():
'# This file was generated by running:',
'# ' + command_line + '',
'#',
- '# Note: After generating, you should remove any unnecessary dependencies.',
+ '# Note: Any unnecessary dependencies should be added to',
+ '# manifest-blacklist.txt and this file should be regenerated.',
'',
]
+
+ blacklist_patterns = []
+ with open(os.path.join(os.sys.path[0], 'manifest-blacklist.txt'), 'r') \
+ as blacklist_file:
+ blacklist_patterns = \
+ [entry.partition('#')[0].strip() for entry \
+ in blacklist_file.readlines()]
+
with open(args.output, 'w') as manifest:
manifest.write('\n'.join(header))
- manifest.write(deps)
+ manifest.write('\n'.join([dep for dep in deps
+ if not IsBlacklisted(dep, blacklist_patterns)]))
print 'Created ' + args.output