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

Side by Side Diff: mojo/public/tools/manifest/manifest_collator.py

Issue 1743473002: Change Mojo URLs to structured names (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@18collapse
Patch Set: . Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « mojo/mojo_shell.gyp ('k') | mojo/services/network/network_service_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2016 The Chromium Authors. All rights reserved. 2 # Copyright 2016 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """ A collator for Mojo Application Manifests """ 6 """ A collator for Mojo Application Manifests """
7 7
8 import argparse 8 import argparse
9 import json 9 import json
10 import shutil 10 import shutil
(...skipping 13 matching lines...) Expand all
24 description="Collate Mojo application manifests.") 24 description="Collate Mojo application manifests.")
25 parser.add_argument("--parent") 25 parser.add_argument("--parent")
26 parser.add_argument("--output") 26 parser.add_argument("--output")
27 parser.add_argument("--application-name") 27 parser.add_argument("--application-name")
28 args, children = parser.parse_known_args() 28 args, children = parser.parse_known_args()
29 29
30 parent = ParseJSONFile(args.parent) 30 parent = ParseJSONFile(args.parent)
31 if parent == None: 31 if parent == None:
32 return 1 32 return 1
33 33
34 parsed = urlparse.urlparse(parent['url']) 34 app_path = parent['name'].split(':')[1]
35 if args.application_name != parsed.hostname: 35 if app_path.startswith('//'):
36 raise ValueError("Application name path component '%s' must not start " \
37 "with //" % app_path)
38
39 if args.application_name != app_path:
36 raise ValueError("Application name '%s' specified in build file does not " \ 40 raise ValueError("Application name '%s' specified in build file does not " \
37 "match application name '%s' specified in manifest." % 41 "match application name '%s' specified in manifest." %
38 (args.application_name, parsed.hostname)) 42 (args.application_name, app_path))
39 43
40 applications = [] 44 applications = []
41 for child in children: 45 for child in children:
42 application = ParseJSONFile(child) 46 application = ParseJSONFile(child)
43 if application == None: 47 if application == None:
44 return 1 48 return 1
45 applications.append(application) 49 applications.append(application)
46 50
47 if len(applications) > 0: 51 if len(applications) > 0:
48 parent['applications'] = applications 52 parent['applications'] = applications
49 53
50 with open(args.output, 'w') as output_file: 54 with open(args.output, 'w') as output_file:
51 json.dump(parent, output_file) 55 json.dump(parent, output_file)
52 56
53 return 0 57 return 0
54 58
55 if __name__ == "__main__": 59 if __name__ == "__main__":
56 sys.exit(main()) 60 sys.exit(main())
OLDNEW
« no previous file with comments | « mojo/mojo_shell.gyp ('k') | mojo/services/network/network_service_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698