diff options
| author | Cristián Maureira-Fredes <Cristian.Maureira-Fredes@qt.io> | 2022-06-27 23:33:10 +0200 |
|---|---|---|
| committer | Cristián Maureira-Fredes <cristian.maureira-fredes@qt.io> | 2022-06-29 11:01:58 +0200 |
| commit | 39b38b0cfc81d352c60c44efeb890b10c3e1bc88 (patch) | |
| tree | a7777082b293a490f73fd49f72820b1dd3fda4a9 /build_scripts/platforms | |
| parent | eba195611ac30fd490e87a03238060eca05f2073 (diff) | |
build: fix readability details
Removing some leftover common anti-patterns:
- remove unnecessary dict() usage
- remove unnecessary map()
- avoid index-based loops
- use capitalize() instead of index-based capitalization
- use f-strings for concatenation
Pick-to: 6.2 6.3
Change-Id: I0ffdf73ec47c6ef537789015052dea0fd047350d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'build_scripts/platforms')
| -rw-r--r-- | build_scripts/platforms/macos.py | 4 | ||||
| -rw-r--r-- | build_scripts/platforms/unix.py | 6 | ||||
| -rw-r--r-- | build_scripts/platforms/windows_desktop.py | 6 |
3 files changed, 8 insertions, 8 deletions
diff --git a/build_scripts/platforms/macos.py b/build_scripts/platforms/macos.py index d7bcd5e0f..6b8d5e1f8 100644 --- a/build_scripts/platforms/macos.py +++ b/build_scripts/platforms/macos.py @@ -12,7 +12,7 @@ from ..versions import PYSIDE def _macos_patch_executable(name, _vars=None): """ Patch an executable to run with the Qt libraries. """ - upper_name = name[0:1].upper() + name[1:] + upper_name = name.capitalize() bundle = f"{{st_build_dir}}/{{st_package_name}}/{upper_name}.app".format(**_vars) binary = f"{bundle}/Contents/MacOS/{upper_name}" rpath = "@loader_path/../../../Qt/lib" @@ -30,7 +30,7 @@ def prepare_standalone_package_macos(self, _vars): if config.is_internal_shiboken_generator_build(): constrain_modules = ["Core", "Network", "Xml", "XmlPatterns"] - constrain_frameworks = ['Qt' + name + '.framework' for name in constrain_modules] + constrain_frameworks = [f"Qt{name}.framework" for name in constrain_modules] copy_plugins = False copy_qml = False copy_translations = False diff --git a/build_scripts/platforms/unix.py b/build_scripts/platforms/unix.py index f345332e0..f109732e3 100644 --- a/build_scripts/platforms/unix.py +++ b/build_scripts/platforms/unix.py @@ -16,7 +16,7 @@ from .macos import prepare_standalone_package_macos def _macos_copy_gui_executable(name, _vars=None): """macOS helper: Copy a GUI executable from the .app folder and return the files""" - app_name = name[:1].upper() + name[1:] + '.app' + app_name = f"{name.capitalize()}.app" return copydir(f"{{install_dir}}/bin/{app_name}", f"{{st_build_dir}}/{{st_package_name}}/{app_name}", _filter=None, recursive=True, @@ -56,9 +56,9 @@ def prepare_packages_posix(self, _vars): def adjusted_lib_name(name, version): postfix = '' if sys.platform.startswith('linux'): - postfix = '.so.' + version + postfix = f".so.{version}" elif sys.platform == 'darwin': - postfix = '.' + version + '.dylib' + postfix = f".{version}.dylib" return name + postfix if config.is_internal_shiboken_module_build(): diff --git a/build_scripts/platforms/windows_desktop.py b/build_scripts/platforms/windows_desktop.py index 6dc6036e0..9dbdd794e 100644 --- a/build_scripts/platforms/windows_desktop.py +++ b/build_scripts/platforms/windows_desktop.py @@ -439,11 +439,11 @@ def copy_qt_artifacts(self, copy_pdbs, _vars): recursive=False, _vars=_vars) - _filter = 'QtWebEngineProcess{}.exe'.format( - 'd' if self.debug else '') + _ext = "d" if self.debug else "" + _filter = [f"QtWebEngineProcess{_ext}.exe"] copydir("{qt_bin_dir}", "{st_build_dir}/{st_package_name}", - _filter=[_filter], + _filter=_filter, recursive=False, _vars=_vars) if copy_qt_conf: |
