electron/script/export_all_patches.py
Jeremy Rose c0d442364a
build: explicitly run scripts with python3 (#33720)
* build: explicitly run scripts with python3

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-04-12 13:21:55 +02:00

33 lines
853 B
Python

#!/usr/bin/env python3
import argparse
import json
from lib import git
def export_patches(dirs, dry_run):
for patch_dir, repo in dirs.items():
git.export_patches(repo=repo, out_dir=patch_dir, dry_run=dry_run)
def parse_args():
parser = argparse.ArgumentParser(description='Export Electron patches')
parser.add_argument('config', nargs='+',
type=argparse.FileType('r'),
help='patches\' config(s) in the JSON format')
parser.add_argument("-d", "--dry-run",
help="Checks whether the exported patches need to be updated.",
default=False, action='store_true')
return parser.parse_args()
def main():
configs = parse_args().config
dry_run = parse_args().dry_run
for config_json in configs:
export_patches(json.load(config_json), dry_run)
if __name__ == '__main__':
main()