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

Side by Side Diff: src/report/report.py

Issue 1677943002: report.format_html now ignores APIs not passed to it. (Closed) Base URL: https://github.com/chromium/caterpillar.git@master
Patch Set: 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 | no next file » | 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 python2 1 #!/usr/bin/env python2
2 # -*- coding: utf-8 -*- 2 # -*- coding: utf-8 -*-
3 3
4 # Copyright 2016 Google Inc. All Rights Reserved. 4 # Copyright 2016 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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 # member with an independent status and set the status of the whole match 261 # member with an independent status and set the status of the whole match
262 # to that. 262 # to that.
263 match_group = match.group(1)[1:] # Slice off the leading dot. 263 match_group = match.group(1)[1:] # Slice off the leading dot.
264 if ('.' not in match_group or 264 if ('.' not in match_group or
265 (match_group.count('.') == 1 and 265 (match_group.count('.') == 1 and
266 match_group.split('.', 1)[0] in {'app', 'sockets', 'system'})): 266 match_group.split('.', 1)[0] in {'app', 'sockets', 'system'})):
267 # This match is either a standalone API (chrome.api) or a special 267 # This match is either a standalone API (chrome.api) or a special
268 # standalone API (chrome.superapi.api) and we can just take the top-level 268 # standalone API (chrome.superapi.api) and we can just take the top-level
269 # status of the API. 269 # status of the API.
270 api = match_group 270 api = match_group
271
272 if api not in apis:
273 return match.group(0)
274
271 status = apis[api]['status'] 275 status = apis[api]['status']
272 return '<span class="ca-feature {}">{}</span>'.format( 276 return '<span class="ca-feature {}">{}</span>'.format(
273 status, match.group(0)) 277 status, match.group(0))
274 278
275 api, member = chrome_app.apis.CHROME_API_AND_MEMBER_REGEX.match( 279 api, member = chrome_app.apis.CHROME_API_AND_MEMBER_REGEX.match(
276 match.group(0)).groups() 280 match.group(0)).groups()
277 281
282 if api not in apis:
283 return match.group(0)
284
278 status = None 285 status = None
279 while True: 286 while True:
280 # Check if the member has a status; if it does, use that, otherwise jump 287 # Check if the member has a status; if it does, use that, otherwise jump
281 # to the parent member. 288 # to the parent member.
282 for warning in apis[api]['warnings']: 289 for warning in apis[api]['warnings']:
283 if member == warning: 290 if member == warning:
284 status = Status.NONE 291 status = Status.NONE
285 break 292 break
286 293
287 try: 294 try:
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 """ 388 """
382 report = generate(chrome_app_manifest, apis, status, warnings, web_path, 389 report = generate(chrome_app_manifest, apis, status, warnings, web_path,
383 boilerplate_dir) 390 boilerplate_dir)
384 report_path = os.path.join(report_dir, 'report.html') 391 report_path = os.path.join(report_dir, 'report.html')
385 with open(report_path, 'w') as report_file: 392 with open(report_path, 'w') as report_file:
386 logging.info('Writing conversion report to `%s`.', report_path) 393 logging.info('Writing conversion report to `%s`.', report_path)
387 report_file.write(surrogateescape.encode(report)) 394 report_file.write(surrogateescape.encode(report))
388 copy_css(report_dir) 395 copy_css(report_dir)
389 install_bower_dependencies(['lato', 'inconsolata', 'code-prettify'], 396 install_bower_dependencies(['lato', 'inconsolata', 'code-prettify'],
390 report_dir) 397 report_dir)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698