forked from f0rmatme/Piana
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmake_release.py
More file actions
76 lines (61 loc) · 2.08 KB
/
Copy pathmake_release.py
File metadata and controls
76 lines (61 loc) · 2.08 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import shutil
import os
import pathlib
from pathlib import Path
from shutil import rmtree
import sys
addon_name = "Piana"
addon_version = sys.argv[1]
addon_filename = addon_name + "-" + addon_version
def remove(path: str):
"""
Remove a file
"""
if os.path.isfile(path) or os.path.islink(path):
os.remove(path) # remove the file
elif os.path.isdir(path):
rmtree(path) # remove dir and all contains
else:
raise ValueError("file {} is not a file or dir.".format(path))
def main():
cwd = Path(os.getcwd())
build_folder = Path(os.path.join(os.path.dirname(__file__), addon_name))
src_folder = Path(os.path.join(os.path.dirname(__file__), "src"))
# TODO : Make this work in Github Actions
# Build cue4extractor
# subprocess.call([
# "dotnet",
# "publish",
# "./src/tools/cue4extractor",
# "-c", "Release",
# "--no-self-contained",
# "-r", "win-x64",
# "-f", "net6.0",
# "-o", "./src/tools/",
# "-p:PublishSingleFile=true",
# "-p:PublishSingleFile=true",
# "-p:DebugType=None",
# "-p:GenerateDocumentationFile=false",
# "-p:DebugSymbols=false",
# "-p:AssemblyVersion=4.0.2.0",
# "-p:FileVersion=4.0.2.0"
# ])
[p.unlink() for p in pathlib.Path(".").rglob("*.py[co]")]
[p.rmdir() for p in pathlib.Path(".").rglob("__pycache__")]
if not build_folder.exists():
build_folder.mkdir(parents=True)
shutil.copytree(src_folder, build_folder, dirs_exist_ok=True)
# Remove unwanted files
remove(os.path.join(build_folder, "tools", "cue4extractor"))
remove(os.path.join(build_folder, ".vscode"))
remove(os.path.join(build_folder, "assets", "VALORANT_Agent_LV.blend"))
remove(os.path.join(build_folder, "assets", "VALORANT_Agent.blend"))
remove(os.path.join(build_folder, "assets", "VALORANT_Weapon.blend"))
shutil.make_archive(
base_name=addon_filename,
format="zip",
root_dir=cwd.__str__(),
base_dir=addon_name,
)
if __name__ == "__main__":
main()