Fix building on Windows
This commit is contained in:
parent
92cfe6fa51
commit
866f57569a
13
prebuild.py
13
prebuild.py
@ -3,9 +3,12 @@
|
|||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
from shutil import which
|
from shutil import which
|
||||||
|
import logging
|
||||||
|
|
||||||
UI_DIR = "assets/ui"
|
UI_DIR = "assets/ui"
|
||||||
|
|
||||||
|
logging.basicConfig(level=logging.INFO)
|
||||||
|
|
||||||
|
|
||||||
class UICNotFound(Exception):
|
class UICNotFound(Exception):
|
||||||
pass
|
pass
|
||||||
@ -17,13 +20,21 @@ if sys.platform == "linux":
|
|||||||
elif sys.platform == "win32":
|
elif sys.platform == "win32":
|
||||||
exe = "pyside6-uic.exe"
|
exe = "pyside6-uic.exe"
|
||||||
exe_alt = None
|
exe_alt = None
|
||||||
|
UI_DIR = UI_DIR.replace("/", "\\")
|
||||||
|
|
||||||
if not which(exe) and not which(exe_alt):
|
if not which(exe) and not which(exe_alt):
|
||||||
raise UICNotFound("User Interface Compiler binary not found.")
|
raise UICNotFound("User Interface Compiler binary not found.")
|
||||||
elif not which(exe) and which(exe_alt):
|
elif not which(exe) and which(exe_alt):
|
||||||
exe = exe_alt
|
exe = exe_alt
|
||||||
|
|
||||||
|
logging.info("Building UI files...")
|
||||||
for f in os.listdir(UI_DIR):
|
for f in os.listdir(UI_DIR):
|
||||||
if exe == "/usr/lib/qt6/uic":
|
if exe == "/usr/lib/qt6/uic":
|
||||||
__flags = "--generator python"
|
__flags = "--generator python"
|
||||||
os.system(f"{exe} {UI_DIR}/{f} -o openfm_qt/ui_{f[:-3]}.py {__flags}")
|
else:
|
||||||
|
__flags = ""
|
||||||
|
cmd = f"{exe} {UI_DIR}/{f} -o openfm_qt/ui_{f[:-3]}.py {__flags}"
|
||||||
|
if sys.platform == "win32":
|
||||||
|
cmd = cmd.replace("/", "\\")
|
||||||
|
os.system(cmd)
|
||||||
|
logging.info(f"Successfully builded {f} as ui_{f[:-3]}.py")
|
||||||
|
@ -18,6 +18,7 @@ classifiers = [
|
|||||||
"Topic :: Multimedia :: Sound/Audio :: Players"
|
"Topic :: Multimedia :: Sound/Audio :: Players"
|
||||||
]
|
]
|
||||||
packages = [{include = "openfm_qt"}]
|
packages = [{include = "openfm_qt"}]
|
||||||
|
include = [{path = "openfm_qt/ui_*.py"}]
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
python = "~3.11"
|
python = "~3.11"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user