| 725 | self.operations = self._get_operations(parser) |
| 726 | |
| 727 | def main(self): |
| 728 | if self.args.paths: |
| 729 | for filename in self.walk(self.args.paths): |
| 730 | self.patch_file(filename) |
| 731 | |
| 732 | if self.applied_operations: |
| 733 | nops = len(self.applied_operations) |
| 734 | ops = ', '.join(sorted(self.applied_operations)) |
| 735 | self.log() |
| 736 | self.log(f"Applied operations ({nops}): {ops}") |
| 737 | |
| 738 | if self.args.download: |
| 739 | path = self.args.download |
| 740 | self.get_latest_header(path) |
| 741 | |
| 742 | if self.pythoncapi_compat_added and not self.args.quiet: |
| 743 | self.log() |
| 744 | self.log(f"{INCLUDE_PYTHONCAPI_COMPAT} added: you may have " |
| 745 | f"to copy {PYTHONCAPI_COMPAT_H} to your project") |
| 746 | self.log("Run 'python upgrade_pythoncapi.py --download <target_path>'") |
| 747 | |
| 748 | sys.exit(self.exitcode) |
| 749 | |
| 750 | |
| 751 | if __name__ == "__main__": |