-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcmp.py
42 lines (36 loc) · 1.03 KB
/
cmp.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
import os,shutil,sys
import py_compile
platform = sys.argv[1]
BuildName = (sys.argv[2])+"_"+platform
files_to_copy: list[str] = [
"cminter.pyc",
"Create.py",
"edit.py",
"menuconfig.py",
"package.toml",
"pkg.py",
"Remove.py",
"shell.py",
"source.py",
"Spiner_settings.json",
("Spiner.sh" if platform == "Unix" else "Spiner.bat"),
"UseConfig",
"License",
"Readme",
"SECURITY.md",
("resources" + os.sep + "HelpMe.md")
]
BuildDir = "Build"
if not os.path.exists(os.path.join(BuildDir,BuildName)):
os.mkdir(os.path.join(BuildDir,BuildName))
else:
shutil.rmtree(os.path.join(BuildDir,BuildName))
os.mkdir(os.path.join(BuildDir,BuildName))
for file in files_to_copy:
if file.endswith(".py"):
py_compile.compile(file)
without_ext = file[:-3]
shutil.copy(f"__pycache__\\{without_ext}.cpython-312.pyc", f"{BuildDir}\\{BuildName}\\{without_ext}.pyc")
shutil.rmtree("__pycache__")
else:
shutil.copy(file,f"{BuildDir}\\{BuildName}\\{file}")