diff --git a/Tools/defines.py b/Tools/defines.py index 2bfbe9c8..b15c60b2 100644 --- a/Tools/defines.py +++ b/Tools/defines.py @@ -6,11 +6,6 @@ from sys import stdout stdout.reconfigure(encoding='utf-8') -VCPKG_VERSION = "2871ddd" # Master 11.11.2022 -QT_VERSION = "6.4.2" if sys.platform != "darwin" else "6.3.2" -QT_IFW_VERSION = "4.5" -SCREENPLAY_VERSION = "0.15.0-RC4" -QT_PATH = Path.cwd().parent.parent.joinpath("aqt") # Defined by Qt if sys.platform == "win32": OS = "windows" @@ -22,5 +17,16 @@ elif sys.platform == "linux": OS = "linux" QT_PLATFORM = "gcc_64" +SCREENPLAY_VERSION = "0.15.0-RC4" + + +QT_PATH = Path.cwd().parent.parent.joinpath("aqt") +QT_VERSION = "6.4.2" if sys.platform != "darwin" else "6.3.2" +QT_BIN_PATH = QT_PATH.joinpath(f"{QT_VERSION}/{QT_PLATFORM}/bin") +QT_TOOLS_PATH = QT_PATH.joinpath("Tools/") +QT_IFW_VERSION = "4.5" + +VCPKG_VERSION = "2871ddd" # Master 11.11.2022 + PYTHON_EXECUTABLE = "python" if sys.platform == "win32" else "python3" FFMPEG_VERSION = "5.0.1" \ No newline at end of file diff --git a/Tools/format_util.py b/Tools/format_util.py index 9592670a..15f91f40 100644 --- a/Tools/format_util.py +++ b/Tools/format_util.py @@ -12,7 +12,7 @@ from sys import stdout stdout.reconfigure(encoding='utf-8') -def find_all_files(path) -> []: +def find_all_files(path): file_list = [] for root, dirnames, files in os.walk(path): for filename in files: @@ -20,7 +20,7 @@ def find_all_files(path) -> []: return file_list -def find_all_git_staged_files() -> []: +def find_all_git_staged_files(): process = subprocess.run("git diff --name-only --staged", capture_output=True, shell=True) out = process.stdout.decode("utf-8") @@ -28,7 +28,7 @@ def find_all_git_staged_files() -> []: return out -def find_files(file_endings_tuple, path="", git_staged_only=False) -> []: +def find_files(file_endings_tuple, path="", git_staged_only=False): file_list = [] # Get the root folder by moving one up root = Path(__file__).parent.absolute() @@ -71,25 +71,3 @@ def check_git_exit(caller_name): # print(out) sys.exit(1) - -def find_absolute_qt_path(qt_version) -> os.path: - compiler = "" - if os.name != 'nt': - print("find_absolute_qt_path is only implemented for Windows!") - sys.exit(1) - - compiler = "msvc2019_64" - - qt_base_path = "C:\\Qt" - if not os.path.exists(qt_base_path): - print("No suitable Qt version found! Searching for version %s" % qt_version) - print("Path searches the root Qt version folder like: C:/Qt/6.0.0/msvc2019_64") - sys.exit(1) - - absolute_qt_path = os.path.join(qt_base_path, qt_version) - if os.path.exists(absolute_qt_path): - return os.path.join(absolute_qt_path, compiler) - else: - print("No suitable Qt version found! Searching for version %s" % qt_version) - print("Path searches the root Qt version folder like: C:/Qt/6.0.0/msvc2019_64") - sys.exit(1) diff --git a/Tools/qml_format.py b/Tools/qml_format.py index 0ac0d6b2..ab0e94e5 100644 --- a/Tools/qml_format.py +++ b/Tools/qml_format.py @@ -4,10 +4,10 @@ import os import subprocess import argparse import sys +import defines from format_util import find_files from format_util import check_git_exit from format_util import execute_threaded -from format_util import find_absolute_qt_path from sys import stdout stdout.reconfigure(encoding='utf-8') @@ -17,8 +17,8 @@ def format_file_function(file): executable = "qmlformat" if os.name == 'nt': executable = "qmlformat.exe" - qt_bin_path = os.path.join(find_absolute_qt_path("6.1.0"), "bin") - executable = os.path.join(qt_bin_path, executable) + qt_bin_path = defines.QT_BIN_PATH + executable = qt_bin_path.joinpath(executable) process = subprocess.run( "%s -i %s" % (executable, file), capture_output=True, shell=True) @@ -26,10 +26,6 @@ def format_file_function(file): def main(git_staged_only=False): - if "" == find_absolute_qt_path("6.1.0"): - print("No suitable qt version found!") - sys.exit(1) - file_list = find_files(('.qml'), os.path.abspath(os.path.join(os.getcwd(), "../")), git_staged_only) execute_threaded(file_list, format_file_function) if not git_staged_only: