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

Side by Side Diff: src/chrome_app/apis.py

Issue 1685693004: Chrome URL bugfix + added tests for chrome_app.apis. (Closed) Base URL: https://github.com/chromium/caterpillar.git@master
Patch Set: Line consistency fix. Created 4 years, 10 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 | « no previous file | src/chrome_app/apis_test.py » ('j') | src/chrome_app/apis_test.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python2 1 #!/usr/bin/env python2
2 # -*- coding: utf-8 -*- 2 # -*- coding: utf-8 -*-
3 3
4 # Copyright 2015 Google Inc. All Rights Reserved. 4 # Copyright 2015 Google Inc. All Rights Reserved.
5 # 5 #
6 # Licensed under the Apache License, Version 2.0 (the "License"); 6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License. 7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at 8 # You may obtain a copy of the License at
9 # 9 #
10 # http://www.apache.org/licenses/LICENSE-2.0 10 # http://www.apache.org/licenses/LICENSE-2.0
(...skipping 24 matching lines...) Expand all
35 import os 35 import os
36 import sys 36 import sys
37 37
38 import manifest as app_manifest 38 import manifest as app_manifest
39 import surrogateescape 39 import surrogateescape
40 import walk 40 import walk
41 41
42 # Regular expression matching Chrome API namespaces, e.g. chrome.tts and 42 # Regular expression matching Chrome API namespaces, e.g. chrome.tts and
43 # chrome.app.window. 43 # chrome.app.window.
44 CHROME_API_REGEX = re.compile( 44 CHROME_API_REGEX = re.compile(
45 r'(?<![\w.])chrome\.((?:(?:app|sockets|system)\.)?\w+)') 45 r'(?<![\w.])chrome\.(?!google)((?:(?:app|sockets|system)\.)?\w+)')
46 46
47 # Regular expression matching Chrome apps API usage, e.g. 47 # Regular expression matching Chrome apps API usage, e.g.
48 # chrome.tts.speak and chrome.app.runtime.onLaunched.addListener. 48 # chrome.tts.speak and chrome.app.runtime.onLaunched.addListener.
49 CHROME_API_USAGE_REGEX = re.compile(r'(?<![\w.])chrome\.((?:\w+\.)+\w+)') 49 CHROME_API_USAGE_REGEX = re.compile(
50 r'(?<![\w.])chrome\.(?!google)((?:\w+\.)+\w+)')
50 51
51 # Regular expression matching anything in the chrome namespace, e.g. chrome.tts 52 # Regular expression matching anything in the chrome namespace, e.g. chrome.tts
52 # or chrome.app.runtime.onLaunched.addListener. 53 # or chrome.app.runtime.onLaunched.addListener.
53 CHROME_NAMESPACE_REGEX = re.compile(r'chrome((?:\.\w+)+)') 54 CHROME_NAMESPACE_REGEX = re.compile(r'chrome((?:\.(?!google)\w+)+)')
54 55
55 # Regular expression matching both the API and the member, assuming both exist. 56 # Regular expression matching both the API and the member, assuming both exist.
56 CHROME_API_AND_MEMBER_REGEX = re.compile(r""" 57 CHROME_API_AND_MEMBER_REGEX = re.compile(r"""
57 (?<![\w.])chrome\. # In the chrome namespace 58 (?<![\w.])chrome\. # In the chrome namespace
59 (?!google) # chrome.google is not an API
Matt Giuca 2016/02/11 02:17:12 Mmmmmm... I don't like this. As you said in the CL
58 ( # Capture the full API name 60 ( # Capture the full API name
59 (?:(?:app|sockets|system)\.)? # API may be part of a super-API namespace 61 (?:(?:app|sockets|system)\.)? # API may be part of a super-API namespace
60 \w+ # Actual API name 62 \w+ # Actual API name
61 ) 63 )
62 \. 64 \.
63 ( # Capture the full member name 65 ( # Capture the full member name
64 (?:\w+\.?)+ 66 (?:\w+\.?)+
65 ) 67 )
66 """, re.VERBOSE) 68 """, re.VERBOSE)
67 69
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 info = apps_apis(args.directory) 207 info = apps_apis(args.directory)
206 for name, path, apis in info: 208 for name, path, apis in info:
207 print("{} ({}): {}".format(name, path, ", ".join(apis))) 209 print("{} ({}): {}".format(name, path, ", ".join(apis)))
208 else: 210 else:
209 apis = app_apis(args.directory) 211 apis = app_apis(args.directory)
210 print(", ".join(apis)) 212 print(", ".join(apis))
211 213
212 214
213 if __name__ == '__main__': 215 if __name__ == '__main__':
214 sys.exit(main()) 216 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | src/chrome_app/apis_test.py » ('j') | src/chrome_app/apis_test.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698