mirror of
https://github.com/thetasoft/wulkplot-translations.git
synced 2026-03-28 16:14:48 +00:00
Fix: Update tools to use venv
This commit is contained in:
@@ -4,7 +4,7 @@ import os
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
TRANSLATIONS_DIR = Path(__file__).resolve().parent.parent
|
TRANSLATIONS_DIR = Path(__file__).resolve().parent.parent
|
||||||
print(TRANSLATIONS_DIR)
|
VENV_RUNNER_DIR = TRANSLATIONS_DIR / "tools" / "translation_venv.py"
|
||||||
|
|
||||||
ts_files = glob.glob(str(TRANSLATIONS_DIR / "*.ts"))
|
ts_files = glob.glob(str(TRANSLATIONS_DIR / "*.ts"))
|
||||||
success = []
|
success = []
|
||||||
@@ -14,7 +14,7 @@ print("Compiling .ts files to .qm:")
|
|||||||
|
|
||||||
for ts_file in ts_files:
|
for ts_file in ts_files:
|
||||||
qm_file = ts_file.replace(".ts", ".qm")
|
qm_file = ts_file.replace(".ts", ".qm")
|
||||||
cmd = ["qt6-tools", "lrelease", ts_file]
|
cmd = ["python", str(VENV_RUNNER_DIR), "lrelease", ts_file]
|
||||||
result = subprocess.run(cmd, capture_output=True, text=True)
|
result = subprocess.run(cmd, capture_output=True, text=True)
|
||||||
|
|
||||||
if result.returncode == 0:
|
if result.returncode == 0:
|
||||||
|
|||||||
@@ -32,6 +32,9 @@ def main():
|
|||||||
run_pyqt6_tools_tool(sys.argv[1:])
|
run_pyqt6_tools_tool(sys.argv[1:])
|
||||||
else:
|
else:
|
||||||
print("Unexpected: qt6-tools found globally, using system environment.")
|
print("Unexpected: qt6-tools found globally, using system environment.")
|
||||||
|
if sys.argv[1] == "pylupdate6":
|
||||||
|
subprocess.run(sys.argv[1:], check=True)
|
||||||
|
else:
|
||||||
subprocess.run(["qt6-tools"] + sys.argv[1:], check=True)
|
subprocess.run(["qt6-tools"] + sys.argv[1:], check=True)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ from pathlib import Path
|
|||||||
|
|
||||||
BASE_DIR = Path(__file__).resolve().parent.parent.parent
|
BASE_DIR = Path(__file__).resolve().parent.parent.parent
|
||||||
TRANSLATIONS_DIR = BASE_DIR / "translations"
|
TRANSLATIONS_DIR = BASE_DIR / "translations"
|
||||||
|
VENV_RUNNER_DIR = TRANSLATIONS_DIR / "tools" / "translation_venv.py"
|
||||||
|
|
||||||
util_qt_files = glob.glob(str(BASE_DIR / "util_qt" / "**" / "*.py"), recursive=True)
|
util_qt_files = glob.glob(str(BASE_DIR / "util_qt" / "**" / "*.py"), recursive=True)
|
||||||
source_files = [str(BASE_DIR / "gui.py")] + util_qt_files
|
source_files = [str(BASE_DIR / "gui.py")] + util_qt_files
|
||||||
@@ -16,7 +17,7 @@ ts_files = [
|
|||||||
str(TRANSLATIONS_DIR / "wulkplot_ru.ts"),
|
str(TRANSLATIONS_DIR / "wulkplot_ru.ts"),
|
||||||
]
|
]
|
||||||
|
|
||||||
cmd = ["pylupdate6"] + source_files
|
cmd = ["python", str(VENV_RUNNER_DIR), "pylupdate6"] + source_files
|
||||||
for ts in ts_files:
|
for ts in ts_files:
|
||||||
cmd += ["-ts", ts]
|
cmd += ["-ts", ts]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user