-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmerge.py
More file actions
30 lines (22 loc) · 1.06 KB
/
Copy pathmerge.py
File metadata and controls
30 lines (22 loc) · 1.06 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
import sys, os
os.environ["SDL_DOC_GENERATOR"] = "0"
os.environ["SDL_DISABLE_METADATA"] = "1"
os.environ["SDL_CHECK_BINARY_VERSION"] = "0"
os.environ["SDL_DOWNLOAD_BINARIES"] = "0"
os.environ["SDL_FIND_BINARIES"] = "0"
import sdl3, shutil, zipfile
def main(argv):
workDir, outDir = os.getcwd(), "artifacts"
if not os.path.exists(os.path.join(workDir, outDir)):
os.mkdir(os.path.join(workDir, outDir))
for module in sdl3.SDL_MODULES:
file = sdl3.SDL_BINARY_PATTERNS[sdl3.SDL_SYSTEM][0].format(module)
path = os.path.join(workDir, module.replace("3", ""), "build", *(["Release", file] if sdl3.SDL_SYSTEM in ["Windows"] else [file]))
if os.path.exists(path): shutil.copyfile(path, os.path.join(workDir, outDir, file))
with zipfile.ZipFile(f"{outDir}.zip", "w", zipfile.ZIP_DEFLATED) as ref:
for root, _, files in os.walk(outDir):
for file in files:
ref.write(path := os.path.join(root, file), os.path.relpath(path, outDir))
return 0
if __name__ == "__main__":
sys.exit(main(sys.argv))