From 00c051da9ace7bf84479103411cba74edee5ca18 Mon Sep 17 00:00:00 2001 From: Elias Steurer Date: Wed, 2 Nov 2022 12:15:34 +0100 Subject: [PATCH] Update python to output utf-8 --- Tools/build.py | 4 ++++ Tools/build_and_publish.py | 4 ++++ Tools/clang_format.py | 4 ++++ Tools/cmake_format.py | 4 ++++ Tools/defines.py | 8 ++++++-- Tools/download_ffmpeg.py | 12 +++++------- Tools/download_qt.py | 2 ++ Tools/execute_util.py | 5 +++-- Tools/format_util.py | 3 +++ Tools/install_requirements.py | 3 +++ Tools/macos_lipo.py | 6 +++--- Tools/macos_sign.py | 5 +++-- Tools/qdoc.py | 3 +++ Tools/qml_format.py | 3 +++ Tools/setup.py | 6 +++++- Tools/steam_publish.py | 3 +++ Tools/util.py | 3 +++ 17 files changed, 61 insertions(+), 17 deletions(-) diff --git a/Tools/build.py b/Tools/build.py index 6d8bb39a..48432f3a 100755 --- a/Tools/build.py +++ b/Tools/build.py @@ -11,6 +11,10 @@ from typing import Tuple from shutil import copytree from pathlib import Path from util import sha256, cd_repo_root_path, zipdir, run, get_vs_env_dict +from sys import stdout + +stdout.reconfigure(encoding='utf-8') + def clean_build_dir(build_dir): if isinstance(build_dir, str): diff --git a/Tools/build_and_publish.py b/Tools/build_and_publish.py index 917e9f2d..ebd8e73b 100644 --- a/Tools/build_and_publish.py +++ b/Tools/build_and_publish.py @@ -11,6 +11,10 @@ import platform import paramiko import defines from util import sftp_exists +from sys import stdout + +stdout.reconfigure(encoding='utf-8') + if __name__ == "__main__": parser = argparse.ArgumentParser(description='Build and Package ScreenPlay') diff --git a/Tools/clang_format.py b/Tools/clang_format.py index 7068a9ba..14277f06 100644 --- a/Tools/clang_format.py +++ b/Tools/clang_format.py @@ -4,6 +4,10 @@ import argparse from format_util import find_files from format_util import check_git_exit from format_util import execute_threaded +from sys import stdout + +stdout.reconfigure(encoding='utf-8') + def format_file_function(file): diff --git a/Tools/cmake_format.py b/Tools/cmake_format.py index 0d570546..7c52ea03 100644 --- a/Tools/cmake_format.py +++ b/Tools/cmake_format.py @@ -3,6 +3,10 @@ import argparse from format_util import find_files from format_util import check_git_exit from format_util import execute_threaded +from sys import stdout + +stdout.reconfigure(encoding='utf-8') + def format_file_function(file): executable = "cmake-format" diff --git a/Tools/defines.py b/Tools/defines.py index c9988af4..4f03ad22 100644 --- a/Tools/defines.py +++ b/Tools/defines.py @@ -1,9 +1,13 @@ import sys from pathlib import Path +from sys import stdout -VCPKG_VERSION = "e2667a41fc2fc578474e9521d7eb90b769569c83" # Master 07.10.2022 +stdout.reconfigure(encoding='utf-8') + +VCPKG_VERSION = "c72cefb" # Master 27.10.2022 QT_VERSION = "6.3.2" QT_IFW_VERSION = "4.4" -SCREENPLAY_VERSION = "0.15.0-RC1" +SCREENPLAY_VERSION = "0.15.0-RC3" AQT_PATH = Path("C:/aqt") if sys.platform == "win32" else Path().home().joinpath("aqt") PYTHON_EXECUTABLE = "python" if sys.platform == "win32" else "python3" +FFMPEG_VERSION = "5.0.1" \ No newline at end of file diff --git a/Tools/download_ffmpeg.py b/Tools/download_ffmpeg.py index 703fa10c..c9e911fb 100644 --- a/Tools/download_ffmpeg.py +++ b/Tools/download_ffmpeg.py @@ -1,16 +1,14 @@ from fileinput import filename -import pathlib from zipfile import ZipFile -from pathlib import Path -import py7zr import platform from urllib.request import urlopen import os +import defines from shutil import move, rmtree from util import cd_repo_root_path +from sys import stdout -FFMPEG_VERSION = "5.0.1" - +stdout.reconfigure(encoding='utf-8') def download( download_server_base_url, @@ -75,8 +73,8 @@ def extract_zip_executables(extraction_path, path_and_filename): def download_prebuild_ffmpeg_mac(extraction_path: str): print("Setup ffmpeg mac") - ffmpeg_zip_name = f'ffmpeg-{FFMPEG_VERSION}.zip' - ffprobe_zip_name = f'ffprobe-{FFMPEG_VERSION}.zip' + ffmpeg_zip_name = f'ffmpeg-{defines.FFMPEG_VERSION}.zip' + ffprobe_zip_name = f'ffprobe-{defines.FFMPEG_VERSION}.zip' download_server_base_url = 'https://evermeet.cx/ffmpeg/' ffmpeg_path_and_filename = download( diff --git a/Tools/download_qt.py b/Tools/download_qt.py index 9cb01657..bc8511bd 100644 --- a/Tools/download_qt.py +++ b/Tools/download_qt.py @@ -5,7 +5,9 @@ import subprocess from platform import platform, system from pathlib import Path from execute_util import execute +from sys import stdout +stdout.reconfigure(encoding='utf-8') def run(cmd, cwd=Path.cwd()): result = subprocess.run(cmd, shell=True, cwd=cwd) diff --git a/Tools/execute_util.py b/Tools/execute_util.py index b18ab35a..250d6abe 100644 --- a/Tools/execute_util.py +++ b/Tools/execute_util.py @@ -1,9 +1,10 @@ import subprocess +from sys import stdout + +stdout.reconfigure(encoding='utf-8') # Python program to print # colored text and background - - def printRed(skk): print("\033[91m {}\033[0;37;40m" .format(skk)) def printGreen(skk): print("\033[92m {}\033[0;37;40m" .format(skk)) def printYellow(skk): print("\033[93m {}\033[0;37;40m" .format(skk)) diff --git a/Tools/format_util.py b/Tools/format_util.py index 4cd7c356..6cf5ae86 100644 --- a/Tools/format_util.py +++ b/Tools/format_util.py @@ -5,6 +5,9 @@ from multiprocessing import cpu_count from multiprocessing import Pool from multiprocessing import dummy from pathlib import Path +from sys import stdout + +stdout.reconfigure(encoding='utf-8') def find_all_files(path) -> []: diff --git a/Tools/install_requirements.py b/Tools/install_requirements.py index 489a6f22..98b1c045 100644 --- a/Tools/install_requirements.py +++ b/Tools/install_requirements.py @@ -2,6 +2,9 @@ import os import sys import subprocess +from sys import stdout + +stdout.reconfigure(encoding='utf-8') def install_requirements(): print("Set up required python modules") diff --git a/Tools/macos_lipo.py b/Tools/macos_lipo.py index 994907fc..8d1e83ee 100644 --- a/Tools/macos_lipo.py +++ b/Tools/macos_lipo.py @@ -1,11 +1,11 @@ #!/usr/bin/python3 from distutils.dir_util import mkpath import os -import shutil -import pathlib from pathlib import Path from util import run, run_and_capture_output, cd_repo_root_path -import warnings +from sys import stdout + +stdout.reconfigure(encoding='utf-8') def listfiles(path): files = [] diff --git a/Tools/macos_sign.py b/Tools/macos_sign.py index 61831e19..092aaea8 100644 --- a/Tools/macos_sign.py +++ b/Tools/macos_sign.py @@ -1,8 +1,9 @@ #!/usr/bin/python3 -import platform -import os from build import BuildConfig from util import run +from sys import stdout + +stdout.reconfigure(encoding='utf-8') def sign(build_config: BuildConfig): print("Run codedesign") diff --git a/Tools/qdoc.py b/Tools/qdoc.py index 1509eb23..7c8eaea4 100644 --- a/Tools/qdoc.py +++ b/Tools/qdoc.py @@ -1,6 +1,9 @@ import subprocess import os import shutil +from sys import stdout + +stdout.reconfigure(encoding='utf-8') def main(): print("\nRuns qdoc with the settings from Docs/config.qdocconf. For this you need to have Qt 6.1 installed!") diff --git a/Tools/qml_format.py b/Tools/qml_format.py index f594e56a..81539603 100644 --- a/Tools/qml_format.py +++ b/Tools/qml_format.py @@ -6,6 +6,9 @@ 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') def format_file_function(file): diff --git a/Tools/setup.py b/Tools/setup.py index a8ec6b8a..2caa57a3 100755 --- a/Tools/setup.py +++ b/Tools/setup.py @@ -8,6 +8,10 @@ import defines import argparse import util import datetime +from sys import stdout + +stdout.reconfigure(encoding='utf-8') + class commands_list(): def __init__(self): @@ -139,7 +143,7 @@ def main(): print(f"Clone into {vcpkg_path}") execute("git clone https://github.com/microsoft/vcpkg.git ScreenPlay-vcpkg", project_source_parent_path, True) execute("git fetch", vcpkg_path) - execute("git checkout {}".format(defines.VCPKG_VERSION), vcpkg_path) + execute(f"git checkout {defines.VCPKG_VERSION}", vcpkg_path) # Setup vcpkg via boostrap script first platform_command.execute_commands() # Execute platform specific commands. diff --git a/Tools/steam_publish.py b/Tools/steam_publish.py index 5209a3e2..c5b389ec 100644 --- a/Tools/steam_publish.py +++ b/Tools/steam_publish.py @@ -10,6 +10,9 @@ from shutil import copyfile import subprocess from util import cd_repo_root_path import platform +from sys import stdout + +stdout.reconfigure(encoding='utf-8') # Executes steamcmd with username and password. Changes the content of the config # for better readability in the steam builds tab diff --git a/Tools/util.py b/Tools/util.py index 64349043..19f111fe 100644 --- a/Tools/util.py +++ b/Tools/util.py @@ -5,6 +5,9 @@ from os import chdir from concurrent.futures import ThreadPoolExecutor import os import subprocess +from sys import stdout + +stdout.reconfigure(encoding='utf-8') def sftp_exists(sftp, path) -> bool: try: