Files
brave-core/script/repack-archive.py
T
mkarolin acc40e803f LZMA executable moved.
Chromium change:

https://source.chromium.org/chromium/chromium/src/+/3fa36902563c565b6c1e7811b7e431a533529a82

commit 3fa36902563c565b6c1e7811b7e431a533529a82
Author: Michael Chang <donchan@microsoft.com>
Date:   Fri Jul 1 19:15:57 2022 +0000

    Clean-up //third_party/lzma_sdk folder

    As part of updating the lzma_sdk, clean up the folders and put them into different subfolders. This puts the files in a more similar
    organization to the original lzma sdk. Fix up other files to have
    correct includes.

    Bug: 1334732
2022-08-23 00:19:18 -04:00

40 lines
1.2 KiB
Python

#!/usr/bin/env python
import argparse
import sys
import os
import subprocess
from lib.util import scoped_cwd, make_zip, tempdir
def GetLZMAExec():
if sys.platform == 'win32':
root_src_dir = os.path.abspath(os.path.join(
os.path.dirname(__file__), *[os.pardir] * 2))
lzma_exec = os.path.join(root_src_dir, "third_party",
"lzma_sdk", "bin", "7za.exe")
else:
lzma_exec = '7zr' # Use system 7zr.
return lzma_exec
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--output', help='Path to output archive.')
parser.add_argument('--input', help='Path to input archive.')
parser.add_argument('--target_dir',
help='If provided, the paths in the archive will be '
'relative to this directory', default='.')
args = parser.parse_args()
temp_dir = tempdir('brave_archive')
lzma_exec = GetLZMAExec()
cmd = [lzma_exec, 'x', args.input, '-y', '-o' + temp_dir]
subprocess.check_call(cmd, stdout=subprocess.PIPE, shell=False)
with scoped_cwd(os.path.join(temp_dir, args.target_dir)):
make_zip(args.output, [], ['.'])
if __name__ == '__main__':
sys.exit(main())