summaryrefslogtreecommitdiff
path: root/chromium/third_party/catapult/catapult_build/print_project_info
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-03-05 17:34:47 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-03-06 10:04:14 +0000
commiteaf1da4d961fbbda9455f9af3b23d1af777f43fa (patch)
tree95970599ecee31c4f7f940bc97ac98c61a3d0cad /chromium/third_party/catapult/catapult_build/print_project_info
parent38a9a29f4f9436cace7f0e7abf9c586057df8a4e (diff)
downloadqtwebengine-chromium-eaf1da4d961fbbda9455f9af3b23d1af777f43fa.tar.gz
BASELINE: Update Chromium to 73.0.3683.64
Change-Id: I76517dc277ba4e16bfd7e098fda3d079656b3b9f Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/third_party/catapult/catapult_build/print_project_info')
-rwxr-xr-xchromium/third_party/catapult/catapult_build/print_project_info80
1 files changed, 80 insertions, 0 deletions
diff --git a/chromium/third_party/catapult/catapult_build/print_project_info b/chromium/third_party/catapult/catapult_build/print_project_info
new file mode 100755
index 00000000000..79be6ebdc4e
--- /dev/null
+++ b/chromium/third_party/catapult/catapult_build/print_project_info
@@ -0,0 +1,80 @@
+#!/usr/bin/env python
+# Copyright (c) 2014 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.
+
+import argparse
+import sys
+import os
+import json
+
+"""
+Prints the source path of the provided project name.
+
+This utility loads the specified x_project.py from one of our standard
+module folders, constructs its project module, and prints the source paths that
+it uses.
+
+This is used by the node_bootstrap.js to load the tracing code into node.
+"""
+
+def _ToUpperCamelCase(name):
+ in_parts = name.split('_')
+ out_parts = []
+ for part in in_parts:
+ out_part = part[0].upper() + part[1:]
+ out_parts.append(out_part)
+ return ''.join(out_parts)
+
+def _RelPathToUnixPath(p):
+ return p.replace(os.sep, '/')
+
+def Main(args):
+ parser = argparse.ArgumentParser(
+ usage='%(prog)s project_name',
+ epilog='Prints the source paths for the provided catapult project\n')
+ parser.add_argument('--source-paths', action='store_true')
+ parser.add_argument('--headless-test-module-filenames', action='store_true')
+ parser.add_argument('project_name', nargs=1)
+ args = parser.parse_args(args)
+
+ catapult_path = os.path.abspath(os.path.join(os.path.dirname(__file__),
+ '..'))
+
+ project_name = args.project_name[0]
+ project_path = os.path.join(catapult_path, project_name)
+ sys.path.append(project_path)
+
+ project_module_name = project_name + '_project'
+ try:
+ project_module = __import__(project_module_name, fromlist=[True])
+ except:
+ sys.stderr.write('Could not import %s from %s' % (project_module_name,
+ project_path))
+ return 1
+
+ project_module.UpdateSysPathIfNeeded()
+
+ class_name = _ToUpperCamelCase(project_name) + 'Project'
+
+ try:
+ project_class = project_module.__dict__[class_name]
+ except:
+ sys.stderr.write('Could not find %s in %s' % (class_name,
+ project_module_name))
+ return 1
+
+ project = project_class()
+
+ if args.source_paths:
+ print json.dumps(project.source_paths)
+
+ if args.headless_test_module_filenames:
+ headless_test_module_filenames = ['/' + _RelPathToUnixPath(x)
+ for x in project.FindAllD8TestModuleRelPaths()]
+ headless_test_module_filenames.sort()
+ print json.dumps(headless_test_module_filenames)
+
+
+if __name__ == '__main__':
+ sys.exit(Main(sys.argv[1:])) \ No newline at end of file