From 08671510ace90d74cb0eaaa0a22cc14e3fb17c98 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 16 Jun 2021 10:24:56 +0200 Subject: Build scripts/UNIX: Extract helper function to copy GUI executables Prepare for adding more binaries. Task-number: PYSIDE-1378 Change-Id: I0156556503b2379a738175491300057e3d7b132c Reviewed-by: Cristian Maureira-Fredes --- build_scripts/platforms/unix.py | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) (limited to 'build_scripts') diff --git a/build_scripts/platforms/unix.py b/build_scripts/platforms/unix.py index 6698cdc13..00f42e73f 100644 --- a/build_scripts/platforms/unix.py +++ b/build_scripts/platforms/unix.py @@ -51,6 +51,31 @@ from ..utils import regenerate_qt_resources from ..versions import PYSIDE, SHIBOKEN +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' + return copydir(f"{{install_dir}}/bin/{app_name}", + f"{{st_build_dir}}/{{st_package_name}}/{app_name}", + filter=None, recursive=True, + force=False, vars=vars) + + +def _unix_copy_gui_executable(name, vars=None): + """UNIX helper: Copy a GUI executable and return the files""" + return copydir("{install_dir}/bin/", + "{st_build_dir}/{st_package_name}/", + filter=[name], + force=False, vars=vars) + + +def _copy_gui_executable(name, vars=None): + """Copy a GUI executable and return the files""" + if sys.platform == 'darwin': + return _macos_copy_gui_executable(name, vars) + return _unix_copy_gui_executable(name, vars) + + def prepare_packages_posix(self, vars): executables = [] @@ -143,18 +168,7 @@ def prepare_packages_posix(self, vars): recursive=False, vars=vars)) # Copying designer - if sys.platform == "darwin": - executables.extend(copydir( - "{install_dir}/bin/Designer.app", - "{st_build_dir}/{st_package_name}/Designer.app", - filter=None, recursive=True, - force=False, vars=vars)) - else: - executables.extend(copydir( - "{install_dir}/bin/", - "{st_build_dir}/{st_package_name}/", - filter=["designer"], - force=False, vars=vars)) + executables.extend(_copy_gui_executable('designer', vars=vars)) # /lib/lib* -> {st_package_name}/ copydir( -- cgit v1.2.3