2018-10-24 18:24:11 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
2018-11-05 16:31:28 +00:00
|
|
|
import argparse
|
|
|
|
import json
|
2019-06-18 22:15:06 +00:00
|
|
|
import os
|
2018-11-05 16:31:28 +00:00
|
|
|
import sys
|
|
|
|
|
2018-10-24 18:24:11 +00:00
|
|
|
from lib import git
|
|
|
|
from lib.patches import patch_from_dir
|
|
|
|
|
|
|
|
|
|
|
|
def apply_patches(dirs):
|
2019-06-18 22:15:06 +00:00
|
|
|
threeway = os.environ.get("ELECTRON_USE_THREE_WAY_MERGE_FOR_PATCHES")
|
2018-10-24 18:24:11 +00:00
|
|
|
for patch_dir, repo in dirs.iteritems():
|
2019-04-23 17:28:26 +00:00
|
|
|
git.import_patches(repo=repo, patch_data=patch_from_dir(patch_dir),
|
2019-06-18 22:15:06 +00:00
|
|
|
threeway=threeway is not None,
|
2018-10-24 18:24:11 +00:00
|
|
|
committer_name="Electron Scripts", committer_email="scripts@electron")
|
|
|
|
|
|
|
|
|
2018-11-05 16:31:28 +00: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 18:24:11 +00:00
|
|
|
def main():
|
2018-11-05 16:31:28 +00:00
|
|
|
configs = parse_args().config
|
|
|
|
for config_json in configs:
|
|
|
|
apply_patches(json.load(config_json))
|
2018-10-24 18:24:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|