-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshock_finder.py
62 lines (57 loc) · 2.19 KB
/
shock_finder.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import sys, os
import ShockFinder
from ShockFinder.Config import ShockFinderDir
from ShockFinder.Update import Update_all
def drop_bk(strc):
if strc != "" and (
strc[0] == "'" and strc[-1] == "'" or strc[0] == '"' and strc[-1] == '"'
):
strc = strc[1:-1]
return strc
if __name__ == "__main__": # windows support
gui = True
for i in sys.argv[1:]:
if "=" not in i:
i = "file=" + i
if i.split("=")[0] in ("f", "-f", "file"):
ShockFinder.ShockFinder(drop_bk(i.split("=")[1]))
gui = False
elif i.split("=")[0] in ("u", "-u", "update"):
Update_all()
gui = False
elif i.split("=")[0] in ("n", "-n", "new"): # new=module@filename
LoaderDir = os.path.join(ShockFinderDir, "Addon", "Loader")
AnalysisToolDir = os.path.join(ShockFinderDir, "Addon", "AnalysisTool")
PainterDir = os.path.join(ShockFinderDir, "Addon", "Painter")
IODir = os.path.join(ShockFinderDir, "Addon", "IO")
MultiprocessEngineDir = os.path.join(
ShockFinderDir, "Addon", "MultiprocessEngine"
)
GUIDir = os.path.join(ShockFinderDir, "Addon", "GUI")
modu = i.split("=")[1].split("@")[0]
mfname = i.split("=")[1].split("@")[1]
if modu in (
"Loader",
"AnalysisTool",
"Painter",
"IO",
"MultiprocessEngine",
"GUI",
):
import shutil
if modu == "Loader":
shutil.copy(mfname, LoaderDir)
elif modu == "AnalysisTool":
shutil.copy(mfname, AnalysisToolDir)
elif modu == "Painter":
shutil.copy(mfname, PainterDir)
elif modu == "IO":
shutil.copy(mfname, IODir)
elif modu == "MultiprocessEngine":
shutil.copy(mfname, MultiprocessEngineDir)
elif modu == "GUI":
shutil.copy(mfname, GUIDir)
Update_all()
gui = False
if gui:
ShockFinder.ShockFinder()