Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2059)

Unified Diff: blimp/tools/generate-engine-manifest.py

Issue 1937423002: Refactor generate engine manifest to accept blacklist as an argument. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clean up to take from sanity check to review ready code. Includes updating blacklist. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: blimp/tools/generate-engine-manifest.py
diff --git a/blimp/tools/generate-engine-manifest.py b/blimp/tools/generate-engine-manifest.py
deleted file mode 100755
index 327f6a8c06bb1060c33ecc195d3a96f3c463b28c..0000000000000000000000000000000000000000
--- a/blimp/tools/generate-engine-manifest.py
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/usr/bin/env python
-# Copyright 2015 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-'''Generates a list of runtime Blimp Engine runtime dependencies.
-'''
-
-
-import argparse
-import fnmatch
-import os
-import subprocess
-import sys
-
-# 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',
- help=('build output directory (e.g. out/Debug)'),
- required=True,
- metavar='DIR')
- parser.add_argument('--target',
- help=('build target of engine'),
- required=True)
- parser.add_argument('--output',
- help=('name and path of manifest file to create'),
- required=True,
- metavar='FILE')
- args = parser.parse_args()
-
- try:
- deps = subprocess.check_output(['gn', 'desc', args.build_dir, args.target,
- 'runtime_deps']).split()
- except subprocess.CalledProcessError as e:
- print "Error: " + ' '.join(e.cmd)
- print e.output
- exit(1)
-
- command_line = ' '.join([os.path.basename(sys.argv[0])] + sys.argv[1:])
- header = [
- '# Runtime dependencies for the Blimp Engine',
- '#',
- '# This file was generated by running:',
- '# ' + command_line + '',
- '#',
- '# 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('\n'.join([dep for dep in deps
- if not IsBlacklisted(dep, blacklist_patterns)]))
-
- print 'Created ' + args.output
-
-if __name__ == "__main__":
- main()

Powered by Google App Engine
This is Rietveld 408576698