From f108c1b77cad247850900d4587c1b0016af05999 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 25 Jan 2018 11:40:44 +0100 Subject: Improve logging of all relevant build folders that are written to This change improves the output of which directories are used when a build is done, as well as adds output for the correct final installation destination (deduced automatically by setuptools, or specified by --prefix option). The change aims to reduce the usual confusion of figuring out which files are written where. Change-Id: I038be7bc657a7fa68e242c38076ffc4ba0548a0b Reviewed-by: Friedemann Kleint --- setup.py | 43 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 7 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 767a59ce5..e8332e1a2 100644 --- a/setup.py +++ b/setup.py @@ -164,6 +164,8 @@ old_submodules = { ], } +pyside_package_dir_name = "pyside_package" + try: import setuptools except ImportError: @@ -270,6 +272,11 @@ OPTION_RPATH_VALUES = option_value("rpath") OPTION_QT_CONF_PREFIX = option_value("qt-conf-prefix") OPTION_ICULIB = option_value("iculib-url") +# This is used automatically by distutils.command.install object, to specify final installation +# location. +OPTION_FINAL_INSTALL_PREFIX = option_value("prefix") + + if OPTION_QT_VERSION is None: OPTION_QT_VERSION = "5" if OPTION_QMAKE is None: @@ -445,7 +452,7 @@ def prepareBuild(): if os.path.isdir(".git") and not OPTION_IGNOREGIT and not OPTION_ONLYPACKAGE and not OPTION_REUSE_BUILD: prepareSubModules() # Clean up temp and package folders - for n in ["pyside_package", "build", "PySide2-%s" % __version__]: + for n in [pyside_package_dir_name, "build", "PySide2-%s" % __version__]: d = os.path.join(script_dir, n) if os.path.isdir(d): print("Removing %s" % d) @@ -455,7 +462,8 @@ def prepareBuild(): print('***** problem removing "{}"'.format(d)) print('ignored error: {}'.format(e)) # Prepare package folders - for pkg in ["pyside_package/PySide2", "pyside_package/pyside2uic"]: + ppdn = pyside_package_dir_name + for pkg in [os.path.join(ppdn, "PySide2"), os.path.join(ppdn, "pyside2uic")]: pkg_dir = os.path.join(script_dir, pkg) os.makedirs(pkg_dir) # locate Qt sources for the documentation @@ -743,6 +751,7 @@ class pyside_build(_build): self.make_generator = make_generator self.debug = OPTION_DEBUG self.script_dir = script_dir + self.pyside_package_dir = os.path.join(self.script_dir, pyside_package_dir_name) self.sources_dir = sources_dir self.build_dir = build_dir self.install_dir = install_dir @@ -754,6 +763,10 @@ class pyside_build(_build): self.site_packages_dir = get_python_lib(1, 0, prefix=install_dir) self.build_tests = OPTION_BUILDTESTS + setuptools_install_prefix = get_python_lib(1) + if OPTION_FINAL_INSTALL_PREFIX: + setuptools_install_prefix = OPTION_FINAL_INSTALL_PREFIX + log.info("=" * 30) log.info("Package version: %s" % __version__) log.info("Build type: %s" % self.build_type) @@ -763,11 +776,27 @@ class pyside_build(_build): log.info("Make generator: %s" % self.make_generator) log.info("Make jobs: %s" % OPTION_JOBS) log.info("-" * 3) + log.info("Script directory: %s" % self.script_dir) log.info("Sources directory: %s" % self.sources_dir) - log.info("Build directory: %s" % self.build_dir) - log.info("Install directory: %s" % self.install_dir) - log.info("Python site-packages install directory: %s" % self.site_packages_dir) + + log.info(dedent(""" + Building PySide2 will create and touch directories in the following order: + make build directory (py*_build/*/*) -> + make install directory (py*_install/*/*) -> + {} directory (pyside_package/*) -> + setuptools build directory (build/*/*) -> + setuptools install directory (usually path-installed-python/lib/python*/site-packages/*) + """).format(pyside_package_dir_name)) + + log.info("make build directory: %s" % self.build_dir) + log.info("make install directory: %s" % self.install_dir) + log.info("%s directory: %s" % (pyside_package_dir_name, self.pyside_package_dir)) + log.info("setuptools build directory: %s" % os.path.join(self.script_dir, "build")) + log.info("setuptools install directory: %s" % setuptools_install_prefix) + log.info("make-installed site-packages directory: %s \n" + " (only relevant for copying files from 'make install directory' " + "to '%s directory'" % (self.site_packages_dir, pyside_package_dir_name)) log.info("-" * 3) log.info("Python executable: %s" % self.py_executable) log.info("Python includes: %s" % self.py_include_dir) @@ -976,7 +1005,7 @@ class pyside_build(_build): "install_dir": self.install_dir, "build_dir": self.build_dir, "script_dir": self.script_dir, - "dist_dir": os.path.join(self.script_dir, 'pyside_package'), + "dist_dir": self.pyside_package_dir, "ssl_libs_dir": OPTION_OPENSSL, "py_version": self.py_version, "qt_version": self.qtinfo.version, @@ -1585,7 +1614,7 @@ setup( packages = ['PySide2', 'pyside2uic', 'pyside2uic.Compiler', 'pyside2uic.port_v%s' % (sys.version_info[0]) ], - package_dir = {'': 'pyside_package'}, + package_dir = {'': pyside_package_dir_name}, include_package_data = True, zip_safe = False, entry_points = { -- cgit v1.2.3 From a7c01e0667a871f3f79e681e3038e273f0c37d9e Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 25 Jan 2018 11:47:47 +0100 Subject: Rename usage of 'dist_dir' to 'pyside_package_dir' The value of 'dist_dir' always meant the 'pyside_package' directory, yet it always added some confusion that it might be something else. Thus remove all mentions of 'dist_dir' to make things more clear. Change-Id: I5037d7a272e96d89424a333adb9c6dc4510d492a Reviewed-by: Friedemann Kleint --- setup.py | 124 +++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 62 insertions(+), 62 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index e8332e1a2..dcf0c5bc3 100644 --- a/setup.py +++ b/setup.py @@ -1005,7 +1005,7 @@ class pyside_build(_build): "install_dir": self.install_dir, "build_dir": self.build_dir, "script_dir": self.script_dir, - "dist_dir": self.pyside_package_dir, + "pyside_package_dir": self.pyside_package_dir, "ssl_libs_dir": OPTION_OPENSSL, "py_version": self.py_version, "qt_version": self.qtinfo.version, @@ -1032,7 +1032,7 @@ class pyside_build(_build): def get_built_pyside_modules(self, vars): # Get list of built modules, so that we copy only required Qt libraries. - pyside_package_dir = vars['dist_dir'] + pyside_package_dir = vars['pyside_package_dir'] built_modules_path = os.path.join(pyside_package_dir, "PySide2", "_built_modules.py") try: @@ -1056,12 +1056,12 @@ class pyside_build(_build): # /shiboken2/doc/html/* -> /PySide2/docs/shiboken2 copydir( "{build_dir}/shiboken2/doc/html", - "{dist_dir}/PySide2/docs/shiboken2", + "{pyside_package_dir}/PySide2/docs/shiboken2", force=False, vars=vars) # /lib/site-packages/PySide2/* -> /PySide2 copydir( "{site_packages_dir}/PySide2", - "{dist_dir}/PySide2", + "{pyside_package_dir}/PySide2", vars=vars) # /lib/site-packages/shiboken2.so -> /PySide2/shiboken2.so shiboken_module_name = 'shiboken2.so' @@ -1073,29 +1073,29 @@ class pyside_build(_build): vars.update({'shiboken_module_name': shiboken_module_name}) copyfile( "{site_packages_dir}/{shiboken_module_name}", - "{dist_dir}/PySide2/{shiboken_module_name}", + "{pyside_package_dir}/PySide2/{shiboken_module_name}", vars=vars) # /lib/site-packages/pyside2uic/* -> /pyside2uic copydir( "{site_packages_dir}/pyside2uic", - "{dist_dir}/pyside2uic", + "{pyside_package_dir}/pyside2uic", force=False, vars=vars) if sys.version_info[0] > 2: - rmtree("{dist_dir}/pyside2uic/port_v2".format(**vars)) + rmtree("{pyside_package_dir}/pyside2uic/port_v2".format(**vars)) else: - rmtree("{dist_dir}/pyside2uic/port_v3".format(**vars)) + rmtree("{pyside_package_dir}/pyside2uic/port_v3".format(**vars)) # /bin/pyside2-uic -> PySide2/scripts/uic.py makefile( - "{dist_dir}/PySide2/scripts/__init__.py", + "{pyside_package_dir}/PySide2/scripts/__init__.py", vars=vars) copyfile( "{install_dir}/bin/pyside2-uic", - "{dist_dir}/PySide2/scripts/uic.py", + "{pyside_package_dir}/PySide2/scripts/uic.py", force=False, vars=vars) # /bin/* -> PySide2/ executables.extend(copydir( "{install_dir}/bin/", - "{dist_dir}/PySide2", + "{pyside_package_dir}/PySide2", filter=[ "pyside2-lupdate", "pyside2-rcc", @@ -1105,7 +1105,7 @@ class pyside_build(_build): # /lib/lib* -> PySide2/ copydir( "{install_dir}/lib/", - "{dist_dir}/PySide2", + "{pyside_package_dir}/PySide2", filter=[ "libpyside*" + so_star, "libshiboken*" + so_star, @@ -1114,28 +1114,28 @@ class pyside_build(_build): # /share/PySide2/typesystems/* -> /PySide2/typesystems copydir( "{install_dir}/share/PySide2/typesystems", - "{dist_dir}/PySide2/typesystems", + "{pyside_package_dir}/PySide2/typesystems", vars=vars) # /include/* -> /PySide2/include copydir( "{install_dir}/include", - "{dist_dir}/PySide2/include", + "{pyside_package_dir}/PySide2/include", vars=vars) # /pyside2/PySide2/support/* -> /PySide2/support/* copydir( "{build_dir}/pyside2/PySide2/support", - "{dist_dir}/PySide2/support", + "{pyside_package_dir}/PySide2/support", vars=vars) if not OPTION_NOEXAMPLES: # /pyside2-examples/examples/* -> /PySide2/examples folder = get_extension_folder('pyside2-examples') copydir( "{sources_dir}/%s/examples" % folder, - "{dist_dir}/PySide2/examples", + "{pyside_package_dir}/PySide2/examples", force=False, vars=vars) # Re-generate examples Qt resource files for Python 3 compatibility if sys.version_info[0] == 3: - examples_path = "{dist_dir}/PySide2/examples".format(**vars) + examples_path = "{pyside_package_dir}/PySide2/examples".format(**vars) pyside_rcc_path = "{install_dir}/bin/pyside2-rcc".format(**vars) pyside_rcc_options = '-py3' regenerate_qt_resources(examples_path, pyside_rcc_path, @@ -1150,7 +1150,7 @@ class pyside_build(_build): # Update rpath to $ORIGIN if sys.platform.startswith('linux') or sys.platform.startswith('darwin'): - self.update_rpath("{dist_dir}/PySide2".format(**vars), executables) + self.update_rpath("{pyside_package_dir}/PySide2".format(**vars), executables) def qt_is_framework_build(self): if os.path.isdir(self.qtinfo.headers_dir + "/../lib/QtCore.framework"): @@ -1196,7 +1196,7 @@ class pyside_build(_build): _print_warn() # /lib/* -> /PySide2/Qt/lib - copydir("{qt_lib_dir}", "{dist_dir}/PySide2/Qt/lib", + copydir("{qt_lib_dir}", "{pyside_package_dir}/PySide2/Qt/lib", filter=[ "libQt5*.so.?", "libicu*.so.??", @@ -1204,24 +1204,24 @@ class pyside_build(_build): recursive=False, vars=vars, force_copy_symlinks=True) if 'WebEngineWidgets' in built_modules: - copydir("{qt_lib_execs_dir}", "{dist_dir}/PySide2/Qt/libexec", + copydir("{qt_lib_execs_dir}", "{pyside_package_dir}/PySide2/Qt/libexec", filter=None, recursive=False, vars=vars) - copydir("{qt_prefix_dir}/resources", "{dist_dir}/PySide2/Qt/resources", + copydir("{qt_prefix_dir}/resources", "{pyside_package_dir}/PySide2/Qt/resources", filter=None, recursive=False, vars=vars) # /plugins/* -> /PySide2/Qt/plugins - copydir("{qt_plugins_dir}", "{dist_dir}/PySide2/Qt/plugins", + copydir("{qt_plugins_dir}", "{pyside_package_dir}/PySide2/Qt/plugins", filter=["*.so"], recursive=True, vars=vars) # /qml/* -> /PySide2/Qt/qml - copydir("{qt_qml_dir}", "{dist_dir}/PySide2/Qt/qml", + copydir("{qt_qml_dir}", "{pyside_package_dir}/PySide2/Qt/qml", filter=None, force=False, recursive=True, @@ -1229,7 +1229,7 @@ class pyside_build(_build): # /translations/* -> /PySide2/Qt/translations - copydir("{qt_translations_dir}", "{dist_dir}/PySide2/Qt/translations", + copydir("{qt_translations_dir}", "{pyside_package_dir}/PySide2/Qt/translations", filter=["*.qm"], force=False, vars=vars) @@ -1268,7 +1268,7 @@ class pyside_build(_build): return False return general_dir_filter(dir_name, parent_full_path, dir_full_path) - copydir("{qt_lib_dir}", "{dist_dir}/PySide2/Qt/lib", + copydir("{qt_lib_dir}", "{pyside_package_dir}/PySide2/Qt/lib", recursive=True, vars=vars, ignore=["*.la", "*.a", "*.cmake", "*.pc", "*.prl"], dir_filter_function=framework_dir_filter) @@ -1279,30 +1279,30 @@ class pyside_build(_build): built_modules.extend(['CLucene']) prefixed_built_modules = ['*Qt5' + name + '*.dylib' for name in built_modules] - copydir("{qt_lib_dir}", "{dist_dir}/PySide2/Qt/lib", + copydir("{qt_lib_dir}", "{pyside_package_dir}/PySide2/Qt/lib", filter=prefixed_built_modules, recursive=True, vars=vars) if 'WebEngineWidgets' in built_modules: - copydir("{qt_lib_execs_dir}", "{dist_dir}/PySide2/Qt/libexec", + copydir("{qt_lib_execs_dir}", "{pyside_package_dir}/PySide2/Qt/libexec", filter=None, recursive=False, vars=vars) - copydir("{qt_prefix_dir}/resources", "{dist_dir}/PySide2/Qt/resources", + copydir("{qt_prefix_dir}/resources", "{pyside_package_dir}/PySide2/Qt/resources", filter=None, recursive=False, vars=vars) # /plugins/* -> /PySide2/Qt/plugins - copydir("{qt_plugins_dir}", "{dist_dir}/PySide2/Qt/plugins", + copydir("{qt_plugins_dir}", "{pyside_package_dir}/PySide2/Qt/plugins", filter=["*.dylib"], recursive=True, dir_filter_function=general_dir_filter, vars=vars) # /qml/* -> /PySide2/Qt/qml - copydir("{qt_qml_dir}", "{dist_dir}/PySide2/Qt/qml", + copydir("{qt_qml_dir}", "{pyside_package_dir}/PySide2/Qt/qml", filter=None, recursive=True, force=False, @@ -1310,7 +1310,7 @@ class pyside_build(_build): vars=vars) # /translations/* -> /PySide2/Qt/translations - copydir("{qt_translations_dir}", "{dist_dir}/PySide2/Qt/translations", + copydir("{qt_translations_dir}", "{pyside_package_dir}/PySide2/Qt/translations", filter=["*.qm"], force=False, vars=vars) @@ -1320,7 +1320,7 @@ class pyside_build(_build): # /lib/site-packages/PySide2/* -> /PySide2 copydir( "{site_packages_dir}/PySide2", - "{dist_dir}/PySide2", + "{pyside_package_dir}/PySide2", vars=vars) built_modules = self.get_built_pyside_modules(vars) @@ -1328,13 +1328,13 @@ class pyside_build(_build): # /pyside2/PySide2/*.pdb -> /PySide2 copydir( "{build_dir}/pyside2/PySide2", - "{dist_dir}/PySide2", + "{pyside_package_dir}/PySide2", filter=pdbs, recursive=False, vars=vars) # /shiboken2/doc/html/* -> /PySide2/docs/shiboken2 copydir( "{build_dir}/shiboken2/doc/html", - "{dist_dir}/PySide2/docs/shiboken2", + "{pyside_package_dir}/PySide2/docs/shiboken2", force=False, vars=vars) # /lib/site-packages/shiboken2.pyd -> /PySide2/shiboken2.pyd shiboken_module_name = 'shiboken2.pyd' @@ -1346,81 +1346,81 @@ class pyside_build(_build): vars.update({'shiboken_module_name': shiboken_module_name}) copyfile( "{site_packages_dir}/{shiboken_module_name}", - "{dist_dir}/PySide2/{shiboken_module_name}", + "{pyside_package_dir}/PySide2/{shiboken_module_name}", vars=vars) if self.debug or self.build_type == 'RelWithDebInfo': copydir( "{build_dir}/shiboken2/shibokenmodule", - "{dist_dir}/PySide2", + "{pyside_package_dir}/PySide2", filter=pdbs, recursive=False, vars=vars) # /lib/site-packages/pyside2uic/* -> /pyside2uic copydir( "{site_packages_dir}/pyside2uic", - "{dist_dir}/pyside2uic", + "{pyside_package_dir}/pyside2uic", force=False, vars=vars) if sys.version_info[0] > 2: - rmtree("{dist_dir}/pyside2uic/port_v2".format(**vars)) + rmtree("{pyside_package_dir}/pyside2uic/port_v2".format(**vars)) else: - rmtree("{dist_dir}/pyside2uic/port_v3".format(**vars)) + rmtree("{pyside_package_dir}/pyside2uic/port_v3".format(**vars)) # /bin/pyside2-uic -> PySide2/scripts/uic.py makefile( - "{dist_dir}/PySide2/scripts/__init__.py", + "{pyside_package_dir}/PySide2/scripts/__init__.py", vars=vars) copyfile( "{install_dir}/bin/pyside2-uic", - "{dist_dir}/PySide2/scripts/uic.py", + "{pyside_package_dir}/PySide2/scripts/uic.py", force=False, vars=vars) # /bin/*.exe,*.dll,*.pdb -> PySide2/ copydir( "{install_dir}/bin/", - "{dist_dir}/PySide2", + "{pyside_package_dir}/PySide2", filter=["*.exe", "*.dll"] + pdbs, recursive=False, vars=vars) # /lib/*.lib -> PySide2/ copydir( "{install_dir}/lib/", - "{dist_dir}/PySide2", + "{pyside_package_dir}/PySide2", filter=["*.lib"], recursive=False, vars=vars) # /share/PySide2/typesystems/* -> /PySide2/typesystems copydir( "{install_dir}/share/PySide2/typesystems", - "{dist_dir}/PySide2/typesystems", + "{pyside_package_dir}/PySide2/typesystems", vars=vars) # /include/* -> /PySide2/include copydir( "{install_dir}/include", - "{dist_dir}/PySide2/include", + "{pyside_package_dir}/PySide2/include", vars=vars) # /pyside2/PySide2/support/* -> /PySide2/support/* copydir( "{build_dir}/pyside2/PySide2/support", - "{dist_dir}/PySide2/support", + "{pyside_package_dir}/PySide2/support", vars=vars) if not OPTION_NOEXAMPLES: # /pyside2-examples/examples/* -> /PySide2/examples folder = get_extension_folder('pyside2-examples') copydir( "{sources_dir}/%s/examples" % folder, - "{dist_dir}/PySide2/examples", + "{pyside_package_dir}/PySide2/examples", force=False, vars=vars) # Re-generate examples Qt resource files for Python 3 compatibility if sys.version_info[0] == 3: - examples_path = "{dist_dir}/PySide2/examples".format(**vars) + examples_path = "{pyside_package_dir}/PySide2/examples".format(**vars) pyside_rcc_path = "{install_dir}/bin/pyside2-rcc".format(**vars) pyside_rcc_options = '-py3' regenerate_qt_resources(examples_path, pyside_rcc_path, pyside_rcc_options) # /* -> /PySide2/openssl - copydir("{ssl_libs_dir}", "{dist_dir}/PySide2/openssl", + copydir("{ssl_libs_dir}", "{pyside_package_dir}/PySide2/openssl", filter=[ "libeay32.dll", "ssleay32.dll"], force=False, vars=vars) # /bin/*.dll -> /PySide2 - copydir("{qt_bin_dir}", "{dist_dir}/PySide2", + copydir("{qt_bin_dir}", "{pyside_package_dir}/PySide2", filter=[ "*.dll", "designer.exe", @@ -1432,58 +1432,58 @@ class pyside_build(_build): recursive=False, vars=vars) if self.debug: # /bin/*d4.dll -> /PySide2 - copydir("{qt_bin_dir}", "{dist_dir}/PySide2", + copydir("{qt_bin_dir}", "{pyside_package_dir}/PySide2", filter=["*d4.dll"] + pdbs, recursive=False, vars=vars) if self.debug or self.build_type == 'RelWithDebInfo': # /lib/*.pdb -> /PySide2 - copydir("{qt_lib_dir}", "{dist_dir}/PySide2", + copydir("{qt_lib_dir}", "{pyside_package_dir}/PySide2", filter=["*.pdb"], recursive=False, vars=vars) # I think these are the qt-mobility DLLs, at least some are, # so let's copy them too # /lib/*.dll -> /PySide2 - copydir("{qt_lib_dir}", "{dist_dir}/PySide2", + copydir("{qt_lib_dir}", "{pyside_package_dir}/PySide2", filter=["*.dll"], ignore=["*d?.dll"], recursive=False, vars=vars) if self.debug: # /lib/*d4.dll -> /PySide2 - copydir("{qt_lib_dir}", "{dist_dir}/PySide2", + copydir("{qt_lib_dir}", "{pyside_package_dir}/PySide2", filter=["*d?.dll"], recursive=False, vars=vars) if self.debug or self.build_type == 'RelWithDebInfo': # /lib/*pdb -> /PySide2 - copydir("{qt_lib_dir}", "{dist_dir}/PySide2", + copydir("{qt_lib_dir}", "{pyside_package_dir}/PySide2", filter=pdbs, recursive=False, vars=vars) # /plugins/* -> /PySide2/plugins - copydir("{qt_plugins_dir}", "{dist_dir}/PySide2/plugins", + copydir("{qt_plugins_dir}", "{pyside_package_dir}/PySide2/plugins", filter=["*.dll"] + pdbs, vars=vars) # /translations/* -> /PySide2/translations - copydir("{qt_translations_dir}", "{dist_dir}/PySide2/translations", + copydir("{qt_translations_dir}", "{pyside_package_dir}/PySide2/translations", filter=["*.qm"], force=False, vars=vars) # /qml/* -> /PySide2/qml - copydir("{qt_qml_dir}", "{dist_dir}/PySide2/qml", + copydir("{qt_qml_dir}", "{pyside_package_dir}/PySide2/qml", filter=None, force=False, recursive=True, vars=vars) if 'WebEngineWidgets' in built_modules: - copydir("{qt_prefix_dir}/resources", "{dist_dir}/PySide2/resources", + copydir("{qt_prefix_dir}/resources", "{pyside_package_dir}/PySide2/resources", filter=None, recursive=False, vars=vars) - copydir("{qt_bin_dir}", "{dist_dir}/PySide2", + copydir("{qt_bin_dir}", "{pyside_package_dir}/PySide2", filter=["QtWebEngineProcess*.exe"], recursive=False, vars=vars) @@ -1497,12 +1497,12 @@ class pyside_build(_build): # @TODO Change the shared library name on Windows. copydir( "{build_dir}/shiboken2/libshiboken", - "{dist_dir}/PySide2", + "{pyside_package_dir}/PySide2", filter=pdbs, recursive=False, vars=vars) copydir( "{build_dir}/pyside2/libpyside", - "{dist_dir}/PySide2", + "{pyside_package_dir}/PySide2", filter=pdbs, recursive=False, vars=vars) -- cgit v1.2.3 From c605d686f8cc4c8d370ec4d6260fca4b423f5526 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 25 Jan 2018 17:43:34 +0100 Subject: Improve libICU deployment on Linux Previously the --standalone build process would download and extract an archive of ICU libraries, regardless of which ICU Qt was built against. The build process will now detect which ICU libraries QtCore depends on and copy the libraries over to the destintation libdir. Something similar might be needed in the future for macOS and Windows. Change-Id: I0db0c8c628d3c095a8a4a1e361f8fafe18da2ec3 Reviewed-by: Friedemann Kleint --- setup.py | 53 ++++++++++++++++------------------------------------- 1 file changed, 16 insertions(+), 37 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index dcf0c5bc3..e4e9a88d9 100644 --- a/setup.py +++ b/setup.py @@ -210,7 +210,8 @@ from utils import init_msvc_env from utils import regenerate_qt_resources from utils import filter_match from utils import osx_fix_rpaths_for_library -from utils import download_and_extract_7z +from utils import copy_icu_libs +from utils import find_files_using_glob from textwrap import dedent # guess a close folder name for extensions @@ -1160,49 +1161,27 @@ class pyside_build(_build): def prepare_standalone_package_linux(self, executables, vars): built_modules = vars['built_modules'] - def _print_warn(): - print(dedent("""\ - *********************************************************** - If one is using Qt binaries provided by QtCompany's CI, - those aren't working as expected! - *********************************************************** - """)) - - # To get working QtCompany Qt CI binaries we have to extract the ICU libs - # If no link provided we'll use the libs from qt-project - icuUrl = "" - if OPTION_ICULIB: - icuUrl = OPTION_ICULIB - else: - qt_version = self.qtinfo.version - url_pre = "http://master.qt.io/development_releases/prebuilt/icu/prebuilt/" - if qt_version.startswith("5.6"): - icuUrl = url_pre + "56.1/icu-linux-g++-Rhel6.6-x64.7z" - else: - icuUrl = url_pre + "56.1/icu-linux-g++-Rhel7.2-x64.7z" - - if find_executable("7z"): - try: - download_and_extract_7z(icuUrl, "{qt_lib_dir}".format(**vars)) - except RuntimeError as e: - # The Qt libs now requires patching to system ICU - # OR it is possible that Qt was built without ICU and - # Works as such - print("Failed to download and extract %s" % icuUrl) - print(str(e)) - _print_warn() - else: - print("Install 7z into PATH to extract ICU libs") - _print_warn() - # /lib/* -> /PySide2/Qt/lib - copydir("{qt_lib_dir}", "{pyside_package_dir}/PySide2/Qt/lib", + destination_lib_dir = "{pyside_package_dir}/PySide2/Qt/lib" + copydir("{qt_lib_dir}", destination_lib_dir, filter=[ "libQt5*.so.?", "libicu*.so.??", ], recursive=False, vars=vars, force_copy_symlinks=True) + # Check if ICU libraries were copied over to the destination Qt libdir. + resolved_destination_lib_dir = destination_lib_dir.format(**vars) + maybe_icu_libs = find_files_using_glob(resolved_destination_lib_dir, "libcu*") + + # If no ICU libraries are present in the Qt libdir (like when Qt is built against system + # ICU, or in the Coin CI where ICU libs are in a different directory) try to + # find out / resolve which ICU libs are used by QtCore (if used at all) using a custom + # written ldd, and copy the ICU libs to the Pyside Qt dir if necessary. We choose the QtCore + # lib to inspect, by checking which QtCore library the shiboken2 executable uses. + if not maybe_icu_libs: + copy_icu_libs(resolved_destination_lib_dir) + if 'WebEngineWidgets' in built_modules: copydir("{qt_lib_execs_dir}", "{pyside_package_dir}/PySide2/Qt/libexec", filter=None, -- cgit v1.2.3 From 6d04376b9993f06700df92a8d03d09b3e75f4408 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Fri, 2 Feb 2018 16:10:23 +0100 Subject: Add setup.py option to output compiler command line invocation Useful for debugging incorrect command line arguments (especially for CI builds). Change-Id: I2c291c1ede5c2e17cdd877f788e8b62876568367 Reviewed-by: Friedemann Kleint --- setup.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'setup.py') diff --git a/setup.py b/setup.py index e4e9a88d9..5855d6f8f 100644 --- a/setup.py +++ b/setup.py @@ -80,6 +80,7 @@ For development purposes the following options might be of use, when using "setu --skip-make-install will not run make install (or equivalent) for each built module, --skip-packaging will skip creation of the python package, --ignore-git will skip the fetching and checkout steps for supermodule and all submodules. + --verbose-build will output the compiler invocation with command line arguments, etc. REQUIREMENTS: - Python: 2.6, 2.7, 3.3, 3.4, 3.5 and 3.6 are supported @@ -272,6 +273,7 @@ OPTION_SKIP_PACKAGING = has_option("skip-packaging") OPTION_RPATH_VALUES = option_value("rpath") OPTION_QT_CONF_PREFIX = option_value("qt-conf-prefix") OPTION_ICULIB = option_value("iculib-url") +OPTION_VERBOSE_BUILD = has_option("verbose-build") # This is used automatically by distutils.command.install object, to specify final installation # location. @@ -921,6 +923,9 @@ class pyside_build(_build): if self.build_type.lower() == 'debug': cmake_cmd.append("-DPYTHON_DEBUG_LIBRARY=%s" % self.py_library) + if OPTION_VERBOSE_BUILD: + cmake_cmd.append("-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON") + if extension.lower() == "pyside2": pyside_qt_conf_prefix = '' if OPTION_QT_CONF_PREFIX: -- cgit v1.2.3 From 63fefd446910a921de7ebc350b9d62caecf0e730 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Fri, 2 Feb 2018 16:11:05 +0100 Subject: Add setup.py option to set the OS X minimum deployment target This is necessary to create binaries that will run on systems older than the system on which the binaries are build. Task-number: PYSIDE-603 Change-Id: Iab1e155d63f0a0cde5de7bbf54ca2c906d8bf188 Reviewed-by: Friedemann Kleint --- setup.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 5855d6f8f..83d179e45 100644 --- a/setup.py +++ b/setup.py @@ -106,6 +106,18 @@ OpenSSL: OS X SDK: You can specify which OS X SDK should be used for compilation with the option --osx-sysroot=. For e.g. "--osx-sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/". + +OS X Minimum deployment target: + You can specify the OS X minimum deployment target with the --osx-deployment-target= option. + For example "--osx-deployment-target=10.10". + + OS X provides the ability to set what is the minimum OS version on which a binary will run. This + means that a build can be done on the latest OS X version with latest XCode and SDK versions, + but the built application / library can run on older OS versions. + + Note: if the option is not set, CMake will try to query the MACOSX_DEPLOYMENT_TARGET environment + variable, and if that is empty, it will try to deduce a value internally (afaik based on + current OS X version and on the chosen SDK version). """ __version__ = "5.6" @@ -265,6 +277,7 @@ OPTION_BUILDTESTS = has_option("build-tests") OPTION_OSXARCH = option_value("osx-arch") OPTION_OSX_USE_LIBCPP = has_option("osx-use-libc++") OPTION_OSX_SYSROOT = option_value("osx-sysroot") +OPTION_OSX_DEPLOYMENT_TARGET = option_value("osx-deployment-target") OPTION_XVFB = has_option("use-xvfb") OPTION_REUSE_BUILD = has_option("reuse-build") OPTION_SKIP_CMAKE = has_option("skip-cmake") @@ -964,6 +977,9 @@ class pyside_build(_build): latest_sdk_path = latest_sdk_path[0] cmake_cmd.append("-DCMAKE_OSX_SYSROOT={0}".format(latest_sdk_path)) + if OPTION_OSX_DEPLOYMENT_TARGET: + cmake_cmd.append("-DCMAKE_OSX_DEPLOYMENT_TARGET={0}" + .format(OPTION_OSX_DEPLOYMENT_TARGET)) if not OPTION_SKIP_CMAKE: log.info("Configuring module %s (%s)..." % (extension, module_src_dir)) -- cgit v1.2.3 From be8585ab74654943b461e81cbf0982d04a1ca9bb Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Fri, 2 Feb 2018 18:40:58 +0100 Subject: Fix deployment of Qt libraries on macOS for standalone packages Previously there was a selection process to choose which libraries to copy over in order to save time and space by not copying libraries for which there are no bindings. The logic was incomplete, and it would be a burden to always update it. Instead it seems that WebEngine is the predominant time consumer when copying, so just simplify the logic to the following: 1) If WebEngine bindings were generated, copy WebEngine Qt libraries 2) If not, don't 3) Copy all other Qt libraries Task-number: PYSIDE-604 Change-Id: Iaa832b5281c9c328f056fd5f9f42e251d55be75f Reviewed-by: Friedemann Kleint --- setup.py | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 83d179e45..673c11e81 100644 --- a/setup.py +++ b/setup.py @@ -1249,14 +1249,8 @@ class pyside_build(_build): def framework_dir_filter(dir_name, parent_full_path, dir_full_path): if '.framework' in dir_name: - if dir_name in ['QtWebEngine.framework', 'QtWebEngineCore.framework', \ - 'QtPositioning.framework', 'QtLocation.framework'] and \ - 'QtWebEngineWidgets.framework' in framework_built_modules: - return True - if dir_name in ['QtCLucene.framework'] and \ - 'QtHelp.framework' in framework_built_modules: - return True - if dir_name not in framework_built_modules: + if dir_name.startswith('QtWebEngine') and \ + 'QtWebEngineWidgets.framework' not in framework_built_modules: return False if dir_name in ['Headers', 'fonts']: return False @@ -1273,14 +1267,14 @@ class pyside_build(_build): ignore=["*.la", "*.a", "*.cmake", "*.pc", "*.prl"], dir_filter_function=framework_dir_filter) else: - if 'WebEngineWidgets' in built_modules: - built_modules.extend(['WebEngine', 'WebEngineCore', 'Positioning', 'Location']) - if 'Help' in built_modules: - built_modules.extend(['CLucene']) - prefixed_built_modules = ['*Qt5' + name + '*.dylib' for name in built_modules] + ignored_modules = [] + if 'WebEngineWidgets' not in built_modules: + ignored_modules.extend(['*Qt5WebEngine*.dylib']) + accepted_modules = ['*Qt5*.dylib'] copydir("{qt_lib_dir}", "{pyside_package_dir}/PySide2/Qt/lib", - filter=prefixed_built_modules, + filter=accepted_modules, + ignore=ignored_modules, recursive=True, vars=vars) if 'WebEngineWidgets' in built_modules: -- cgit v1.2.3