| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import os.path | 5 import os.path |
| 6 import sys | 6 import sys |
| 7 import optparse | 7 import optparse |
| 8 import collections | 8 import collections |
| 9 import functools | 9 import functools |
| 10 import re | 10 import re |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 return domain in self.generate_domains | 433 return domain in self.generate_domains |
| 434 return self.check_options(self.config.protocol.options, domain, command,
"include", "exclude", True) | 434 return self.check_options(self.config.protocol.options, domain, command,
"include", "exclude", True) |
| 435 | 435 |
| 436 | 436 |
| 437 def generate_event(self, domain, event): | 437 def generate_event(self, domain, event): |
| 438 if not self.config.protocol.options: | 438 if not self.config.protocol.options: |
| 439 return domain in self.generate_domains | 439 return domain in self.generate_domains |
| 440 return self.check_options(self.config.protocol.options, domain, event, "
include_events", "exclude_events", True) | 440 return self.check_options(self.config.protocol.options, domain, event, "
include_events", "exclude_events", True) |
| 441 | 441 |
| 442 | 442 |
| 443 def generate_type(self, domain, typename): |
| 444 if not self.config.protocol.options: |
| 445 return domain in self.generate_domains |
| 446 return self.check_options(self.config.protocol.options, domain, typename
, "include_types", "exclude_types", True) |
| 447 |
| 448 |
| 443 def is_async_command(self, domain, command): | 449 def is_async_command(self, domain, command): |
| 444 if not self.config.protocol.options: | 450 if not self.config.protocol.options: |
| 445 return False | 451 return False |
| 446 return self.check_options(self.config.protocol.options, domain, command,
"async", None, False) | 452 return self.check_options(self.config.protocol.options, domain, command,
"async", None, False) |
| 447 | 453 |
| 448 | 454 |
| 449 def is_exported(self, domain, name): | 455 def is_exported(self, domain, name): |
| 450 if not self.config.protocol.options: | 456 if not self.config.protocol.options: |
| 451 return False | 457 return False |
| 452 return self.check_options(self.config.protocol.options, domain, name, "e
xported", None, False) | 458 return self.check_options(self.config.protocol.options, domain, name, "e
xported", None, False) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 466 | 472 |
| 467 def generate_disable(self, domain): | 473 def generate_disable(self, domain): |
| 468 if "commands" not in domain: | 474 if "commands" not in domain: |
| 469 return True | 475 return True |
| 470 for command in domain["commands"]: | 476 for command in domain["commands"]: |
| 471 if command["name"] == "disable" and self.generate_command(domain["do
main"], "disable"): | 477 if command["name"] == "disable" and self.generate_command(domain["do
main"], "disable"): |
| 472 return False | 478 return False |
| 473 return True | 479 return True |
| 474 | 480 |
| 475 | 481 |
| 482 def is_imported_dependency(self, domain): |
| 483 return domain in self.generate_domains or domain in self.imported_domain
s |
| 484 |
| 485 |
| 476 def main(): | 486 def main(): |
| 477 jinja_dir, config_file, config = read_config() | 487 jinja_dir, config_file, config = read_config() |
| 478 | 488 |
| 479 protocol = Protocol(config) | 489 protocol = Protocol(config) |
| 480 | 490 |
| 481 if not config.exported and len(protocol.exported_domains): | 491 if not config.exported and len(protocol.exported_domains): |
| 482 sys.stderr.write("Domains [%s] are exported, but config is missing expor
t entry\n\n" % ", ".join(protocol.exported_domains)) | 492 sys.stderr.write("Domains [%s] are exported, but config is missing expor
t entry\n\n" % ", ".join(protocol.exported_domains)) |
| 483 exit(1) | 493 exit(1) |
| 484 | 494 |
| 485 if not os.path.exists(config.protocol.output): | 495 if not os.path.exists(config.protocol.output): |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 if up_to_date: | 593 if up_to_date: |
| 584 sys.exit() | 594 sys.exit() |
| 585 | 595 |
| 586 for file_name, content in outputs.iteritems(): | 596 for file_name, content in outputs.iteritems(): |
| 587 out_file = open(file_name, "w") | 597 out_file = open(file_name, "w") |
| 588 out_file.write(content) | 598 out_file.write(content) |
| 589 out_file.close() | 599 out_file.close() |
| 590 | 600 |
| 591 | 601 |
| 592 main() | 602 main() |
| OLD | NEW |