-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.py
executable file
·40 lines (28 loc) · 884 Bytes
/
build.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
from __future__ import annotations
import os
import platform
import sys
from pathlib import Path
from PyInstaller.__main__ import run as run_pyinstaller
#
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
OS_NAME: str = sys.platform
IS_LINUX: bool = OS_NAME == "linux"
def main() -> int:
output_folder: Path = Path.cwd() / "build"
output_file: Path = output_folder / ("osr2png" + ["", ".exe"][not IS_LINUX])
print(f"Building osr2png for {OS_NAME} {platform.machine()}.")
print(f"Final file: {output_file}")
opts = [
f"--name=osr2png",
"--upx-exclude=vcruntime140.dll",
"--noconfirm",
"--recursive-copy-metadata=ossapi",
"--onefile",
"main.py",
]
print(f"Running PyInstaller with {opts}")
run_pyinstaller(opts)
return 0
if __name__ == "__main__":
raise SystemExit(main())