Add possibility to have MgBench working against local file
This commit is contained in:
parent
e1f18f3733
commit
4c5cd1f847
@ -28,18 +28,25 @@ def get_binary_path(path, base=""):
|
|||||||
|
|
||||||
|
|
||||||
def download_file(url, path):
|
def download_file(url, path):
|
||||||
ret = subprocess.run(["wget", "-nv", "--content-disposition", url],
|
if "https://" in url:
|
||||||
stderr=subprocess.PIPE, cwd=path, check=True)
|
ret = subprocess.run(
|
||||||
data = ret.stderr.decode("utf-8")
|
["wget", "-nv", "--content-disposition", url], stderr=subprocess.PIPE, cwd=path, check=True
|
||||||
tmp = data.split("->")[1]
|
)
|
||||||
name = tmp[tmp.index('"') + 1:tmp.rindex('"')]
|
data = ret.stderr.decode("utf-8")
|
||||||
return os.path.join(path, name)
|
tmp = data.split("->")[1]
|
||||||
|
name = tmp[tmp.index('"') + 1 : tmp.rindex('"')]
|
||||||
|
return os.path.join(path, name)
|
||||||
|
else:
|
||||||
|
assert os.path.exists(url)
|
||||||
|
subprocess.run(["cp", url, path], stderr=subprocess.PIPE, cwd=path, check=True)
|
||||||
|
tmp = url.split("/")
|
||||||
|
name = tmp[len(tmp) - 1]
|
||||||
|
return os.path.join(path, name)
|
||||||
|
|
||||||
|
|
||||||
def unpack_and_move_file(input_path, output_path):
|
def unpack_and_move_file(input_path, output_path):
|
||||||
if input_path.endswith(".gz"):
|
if input_path.endswith(".gz"):
|
||||||
subprocess.run(["gunzip", input_path],
|
subprocess.run(["gunzip", input_path], stdout=subprocess.DEVNULL, check=True)
|
||||||
stdout=subprocess.DEVNULL, check=True)
|
|
||||||
input_path = input_path[:-3]
|
input_path = input_path[:-3]
|
||||||
os.rename(input_path, output_path)
|
os.rename(input_path, output_path)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user