2020-04-08 15:59:14 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
import argparse
|
|
|
|
import json
|
|
|
|
|
|
|
|
from lib import git
|
|
|
|
|
|
|
|
|
2020-06-05 00:43:28 +00:00
|
|
|
def export_patches(dirs, dry_run):
|
2020-04-08 15:59:14 +00:00
|
|
|
for patch_dir, repo in dirs.iteritems():
|
2020-06-05 00:43:28 +00:00
|
|
|
git.export_patches(repo=repo, out_dir=patch_dir, dry_run=dry_run)
|
2020-04-08 15:59:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
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')
|
2020-06-05 00:43:28 +00:00
|
|
|
parser.add_argument("-d", "--dry-run",
|
|
|
|
help="Checks whether the exported patches need to be updated.",
|
|
|
|
default=False, action='store_true')
|
2020-04-08 15:59:14 +00:00
|
|
|
return parser.parse_args()
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
configs = parse_args().config
|
2020-06-05 00:43:28 +00:00
|
|
|
dry_run = parse_args().dry_run
|
2020-04-08 15:59:14 +00:00
|
|
|
for config_json in configs:
|
2020-06-05 00:43:28 +00:00
|
|
|
export_patches(json.load(config_json), dry_run)
|
2020-04-08 15:59:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|