diff --git a/npm-scripts.mjs b/npm-scripts.mjs index 7ca9942e75..2089a6379e 100644 --- a/npm-scripts.mjs +++ b/npm-scripts.mjs @@ -445,7 +445,9 @@ function installMsysMake() pythonPath = String(res.stdout).trim(); } - executeCmd(`${pythonPath} worker\\scripts\\getmake.py`); + const dir = path.resolve('worker/out/msys'); + + executeCmd(`${pythonPath} worker\\scripts\\getmake.py --dir="${dir}"`); } function ensureDir(dir) diff --git a/worker/scripts/getmake.py b/worker/scripts/getmake.py index c6c0dbb9a3..50ec9ea7f1 100644 --- a/worker/scripts/getmake.py +++ b/worker/scripts/getmake.py @@ -1,10 +1,21 @@ -import io, hashlib, tarfile, urllib.request +import argparse, io, hashlib, tarfile, urllib.request + +argParser = argparse.ArgumentParser() + +argParser.add_argument( + '--dir', + type=str, + required=True, + help='absolute path of the directoy in which fetched content will be placed' +) + +args = argParser.parse_args() def get(url, digest): data = urllib.request.urlopen(url).read() assert hashlib.sha256(data).hexdigest() == digest tar = tarfile.open(fileobj=io.BytesIO(data)) - tar.extractall('worker/out/msys') + tar.extractall(args.dir) tar.close() get('https://sourceforge.net/projects/mingw/files/MSYS/Base/msys-core/msys-1.0.19-1/msysCORE-1.0.19-1-msys-1.0.19-bin.tar.xz/download', '8c4157d739a460f85563bc4451e9f1bbd42b13c4f63770d43b9f45a781f07858')