2018-10-24 21:24:11 +03:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
2018-11-05 19:31:28 +03:00
|
|
|
import argparse
|
|
|
|
import json
|
2019-06-19 01:15:06 +03:00
|
|
|
import os
|
2018-11-05 19:31:28 +03:00
|
|
|
|
2018-10-24 21:24:11 +03:00
|
|
|
from lib import git
|
|
|
|
from lib.patches import patch_from_dir
|
|
|
|
|
|
|
|
|
|
|
|
def apply_patches(dirs):
|
2019-06-19 01:15:06 +03:00
|
|
|
threeway = os.environ.get("ELECTRON_USE_THREE_WAY_MERGE_FOR_PATCHES")
|
2019-08-24 01:48:27 +03:00
|
|
|
for patch_dir, repo in dirs.items():
|
2019-04-23 20:28:26 +03:00
|
|
|
git.import_patches(repo=repo, patch_data=patch_from_dir(patch_dir),
|
2019-06-19 01:15:06 +03:00
|
|
|
threeway=threeway is not None,
|
2018-10-24 21:24:11 +03:00
|
|
|
committer_name="Electron Scripts", committer_email="scripts@electron")
|
|
|
|
|
|
|
|
|
2018-11-05 19:31:28 +03:00
|
|
|
def parse_args():
|
|
|
|
parser = argparse.ArgumentParser(description='Apply Electron patches')
|
|
|
|
parser.add_argument('config', nargs='+',
|
|
|
|
type=argparse.FileType('r'),
|
|
|
|
help='patches\' config(s) in the JSON format')
|
|
|
|
return parser.parse_args()
|
|
|
|
|
|
|
|
|
2018-10-24 21:24:11 +03:00
|
|
|
def main():
|
2018-11-05 19:31:28 +03:00
|
|
|
configs = parse_args().config
|
|
|
|
for config_json in configs:
|
|
|
|
apply_patches(json.load(config_json))
|
2018-10-24 21:24:11 +03:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|