diff --git a/DEPS b/DEPS index b6271a163b..78c6b414ad 100644 --- a/DEPS +++ b/DEPS @@ -4,7 +4,6 @@ deps = { "vendor/node": "https://github.com/brave/node.git@7535fd34c36a40403743af5bf71c5b79b3f0bb6d", "vendor/requests": "https://github.com/kennethreitz/requests@e4d59bedfd3c7f4f254f4f5d036587bcd8152458", "vendor/boto": "https://github.com/boto/boto@f7574aa6cc2c819430c1f05e9a1a1a666ef8169b", - "vendor/python-patch": "https://github.com/svn2github/python-patch@a336a458016ced89aba90dfc3f4c8222ae3b1403", } hooks = [ diff --git a/script/apply-patches.py b/script/apply-patches.py index abc940dfc4..491ba21f94 100755 --- a/script/apply-patches.py +++ b/script/apply-patches.py @@ -7,9 +7,8 @@ SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) PATCHES_DIR = os.path.join(SOURCE_ROOT, 'patches') -VENDOR_DIR = os.path.join(SOURCE_ROOT, 'vendor') SRC_DIR = os.path.join(SOURCE_ROOT, '..', '..', 'src') -PATCH_PY = os.path.join(VENDOR_DIR, 'python-patch', 'patch.py') +GIT_EXE = 'git' def main(): @@ -19,7 +18,6 @@ def main(): sys.stderr.write(error + '\n') sys.stderr.flush() - revert_changes_for_dir(PATCHES_DIR) return 1 @@ -27,27 +25,17 @@ def apply_patches_for_dir(directory): for root, dirs, files in os.walk(directory): prefix = os.path.relpath(root, directory) target = os.path.join(SRC_DIR, prefix) - args = [sys.executable, PATCH_PY, '--directory', target, '--quiet'] + args = [GIT_EXE, 'apply', '--unsafe-paths', '--directory=' + + os.path.normpath(target)] for name in sorted(files): if not name.endswith('.patch'): continue patch = os.path.join(root, name) - if subprocess.call(args + [patch]): + args += [patch] + print(' '.join(args)) + if subprocess.call(args): return '{0} failed to apply'.format(os.path.basename(patch)) -def revert_changes_for_dir(directory): - for root, dirs, files in reversed(list(os.walk(directory))): - prefix = os.path.relpath(root, directory) - target = os.path.join(SRC_DIR, prefix) - args = [sys.executable, PATCH_PY, '--directory', target, '--quiet', - '--revert'] - for name in reversed(sorted(files)): - if not name.endswith('.patch'): - continue - patch = os.path.join(root, name) - subprocess.call(args + [patch]) - - if __name__ == '__main__': sys.exit(main())