-
Notifications
You must be signed in to change notification settings - Fork 43
/
extract.py
33 lines (27 loc) · 944 Bytes
/
extract.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import os
import subprocess
def extract_msi(input: str, output: str, overwrite: bool = False):
if not overwrite and os.path.exists(output):
return
subprocess.check_output(["msiextract", input, "-C", output])
def extract_txz(input: str, output: str, overwrite: bool = False):
if not overwrite and os.path.exists(output):
return
os.makedirs(output, exist_ok=True)
subprocess.check_output(["tar", "Jxf", input, "-C", output])
def extract_dmg(input: str, output: str, overwrite: bool = False):
if not overwrite and os.path.exists(output):
return
subprocess.run(
[
"7zz",
"x",
"-y",
"-o" + output,
input,
"calibre.app/Contents/Frameworks/plugins/python-lib.bypy.frozen",
"calibre.app/Contents/Frameworks/calibre-launcher.dylib",
],
check=False,
stdout=subprocess.PIPE,
)