diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-07-03 14:41:11 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-07-03 14:51:45 +0200 |
commit | d850748283698596327653ec30decdbd6c964af8 (patch) | |
tree | 6efc71e7877294fb616f88f1f17f089d4dce1b84 /build_scripts | |
parent | 46ff21ee14e00b992b49562943274d62f2b5b456 (diff) | |
parent | ffae5fe2f3312fdad7ef5880308dae4fd31fec94 (diff) |
Merge remote-tracking branch 'origin/5.11' into dev
Change-Id: Ib2eeca97ebabcff53ef7ddd9fc769be6424db39f
Diffstat (limited to 'build_scripts')
-rw-r--r-- | build_scripts/main.py | 16 | ||||
-rw-r--r-- | build_scripts/options.py | 1 | ||||
-rw-r--r-- | build_scripts/platforms/windows_desktop.py | 23 | ||||
-rw-r--r-- | build_scripts/utils.py | 13 | ||||
-rw-r--r-- | build_scripts/wheel_override.py | 262 |
5 files changed, 183 insertions, 132 deletions
diff --git a/build_scripts/main.py b/build_scripts/main.py index f288756c1..8d3a58eb0 100644 --- a/build_scripts/main.py +++ b/build_scripts/main.py @@ -51,6 +51,11 @@ setup_py_path = os.path.join(setup_script_dir, "setup.py") @memoize def get_package_timestamp(): + """ In a Coin CI build the returned timestamp will be the + Coin integration id timestamp. For regular builds it's + just the current timestamp or a user provided one.""" + if OPTION_PACKAGE_TIMESTAMP: + return OPTION_PACKAGE_TIMESTAMP return int(time.time()) @memoize @@ -461,6 +466,7 @@ class PysideBuild(_build): self.py_include_dir = None self.py_library = None self.py_version = None + self.py_arch = None self.build_type = "Release" self.qtinfo = None self.build_tests = False @@ -469,6 +475,7 @@ class PysideBuild(_build): prepare_build() platform_arch = platform.architecture()[0] log.info("Python architecture is {}".format(platform_arch)) + self.py_arch = platform_arch[:-3] build_type = "Debug" if OPTION_DEBUG else "Release" if OPTION_RELWITHDEBINFO: @@ -499,6 +506,9 @@ class PysideBuild(_build): log.info("nmake was found in {}".format(nmake_path)) make_name = "nmake" make_generator = "NMake Makefiles" + if OPTION_JOBS: + msg = "Option --jobs can only be used with 'jom' on Windows." + raise DistutilsSetupError(msg) elif OPTION_MAKESPEC == "mingw": make_name = "mingw32-make" make_generator = "MinGW Makefiles" @@ -1011,7 +1021,7 @@ class PysideBuild(_build): cmake_cmd.append("-DPYSIDE_SETUP_PY_PACKAGE_TIMESTAMP={}".format( timestamp)) - if extension.lower() == "shiboken2": + if extension.lower() in ["shiboken2", "pyside2-tools"]: cmake_cmd.append("-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=yes") if sys.version_info[0] > 2: cmake_cmd.append("-DUSE_PYTHON_VERSION=3.3") @@ -1131,6 +1141,7 @@ class PysideBuild(_build): "qt_prefix_dir": self.qtinfo.prefix_dir, "qt_translations_dir": self.qtinfo.translations_dir, "qt_qml_dir": self.qtinfo.qml_dir, + "target_arch": self.py_arch, } os.chdir(self.script_dir) @@ -1157,7 +1168,8 @@ class PysideBuild(_build): return config def is_webengine_built(self, built_modules): - return 'WebEngineWidgets' in built_modules or 'WebEngineCore' in built_modules + return ('WebEngineWidgets' in built_modules or 'WebEngineCore' in built_modules + or 'WebEngine' in built_modules) def prepare_standalone_clang(self, is_win = False): """ diff --git a/build_scripts/options.py b/build_scripts/options.py index d7174feff..fd8b0718e 100644 --- a/build_scripts/options.py +++ b/build_scripts/options.py @@ -81,3 +81,4 @@ OPTION_VERBOSE_BUILD = has_option("verbose-build") OPTION_SANITIZE_ADDRESS = has_option("sanitize-address") OPTION_SNAPSHOT_BUILD = has_option("snapshot-build") OPTION_LIMITED_API = option_value("limited-api") +OPTION_PACKAGE_TIMESTAMP = option_value("package-timestamp") diff --git a/build_scripts/platforms/windows_desktop.py b/build_scripts/platforms/windows_desktop.py index f4b4aed6e..3bf386a17 100644 --- a/build_scripts/platforms/windows_desktop.py +++ b/build_scripts/platforms/windows_desktop.py @@ -42,6 +42,8 @@ import os, re, sys from ..options import * from ..utils import copydir, copyfile, rmtree, makefile from ..utils import regenerate_qt_resources, filter_match +from ..utils import download_and_extract_7z + def prepare_packages_win32(self, vars): # For now, debug symbols will not be shipped into the package. copy_pdbs = False @@ -187,6 +189,16 @@ def prepare_packages_win32(self, vars): "lconvert.exe", "qtdiag.exe" ] + # MSVC redistributable + msvc_redist = [ + "concrt140.dll", + "msvcp140.dll", + "ucrtbase.dll", + "vcamp140.dll", + "vccorlib140.dll", + "vcomp140.dll" , + "vcruntime140.dll" + ] # Choose which EGL library variants to copy. qt_artifacts_egl = [ @@ -201,6 +213,17 @@ def prepare_packages_win32(self, vars): egl_suffix = '' qt_artifacts_egl = [a.format(egl_suffix) for a in qt_artifacts_egl] qt_artifacts_permanent += qt_artifacts_egl + qt_artifacts_permanent += msvc_redist + + # Extract Qt dependency dll's when building on Qt CI + # There is no proper CI env variable, so using agent launch params + in_coin = os.environ.get('COIN_LAUNCH_PARAMETERS', None) + if in_coin is not None: + redist_url = "http://download.qt.io/development_releases/prebuilt/vcredist//" + zip_file = "pyside_qt_deps_64.7z" + if "{target_arch}".format(**vars) == "32": + zip_file = "pyside_qt_deps_32.7z" + download_and_extract_7z(redist_url + zip_file, "{qt_bin_dir}".format(**vars)) copydir("{qt_bin_dir}", "{pyside_package_dir}/PySide2", filter=qt_artifacts_permanent, diff --git a/build_scripts/utils.py b/build_scripts/utils.py index cca93d09f..1a622aad5 100644 --- a/build_scripts/utils.py +++ b/build_scripts/utils.py @@ -1117,3 +1117,16 @@ def run_instruction(instruction, error): if result != 0: print("ERROR : " + error) exit(result) + +def acceptCITestConfiguration(hostOS, hostOSVer, targetArch, compiler): + # Disable unsupported CI configs for now + # NOTE: String must match with QT CI's storagesturct thrift + if hostOSVer in ["WinRT_10", "MacOS_10_13"]: + print("Disabled " + hostOSVer + " from Coin configuration") + return False + # With 5.11 CI will create two sets of release binaries, one with msvc 2015 and one with msvc 2017 + # we shouldn't release the 2015 version. BUT, 32 bit build is done only on msvc 2015... + if compiler in ["MSVC2015"] and targetArch in ["X86_64"]: + print("Disabled " + compiler + " to " + targetArch + " from Coin configuration") + return False + return True diff --git a/build_scripts/wheel_override.py b/build_scripts/wheel_override.py index ee8bd8382..838de1af1 100644 --- a/build_scripts/wheel_override.py +++ b/build_scripts/wheel_override.py @@ -43,7 +43,7 @@ wheel_module_exists = False try: import os, sys - from distutils import log + from distutils import log as logger from wheel import pep425tags from wheel.bdist_wheel import bdist_wheel as _bdist_wheel from wheel.bdist_wheel import safer_name as _safer_name @@ -56,7 +56,9 @@ try: wheel_module_exists = True except Exception as e: - print('***** Exception while trying to prepare bdist_wheel override class: {}. Skipping wheel overriding.'.format(e)) + _bdist_wheel, wheel_version = type, '' # dummy to make class statement happy + print('***** Exception while trying to prepare bdist_wheel override class: {}. ' + 'Skipping wheel overriding.'.format(e)) def get_bdist_wheel_override(params): if wheel_module_exists: @@ -68,133 +70,133 @@ def get_bdist_wheel_override(params): else: return None -if wheel_module_exists: - class PysideBuildWheel(_bdist_wheel): - def __init__(self, *args, **kwargs): - self.pyside_params = None - _bdist_wheel.__init__(self, *args, **kwargs) - - @property - def wheel_dist_name(self): - # Slightly modified version of wheel's wheel_dist_name - # method, to add the Qt version as well. - # Example: - # PySide2-5.6-5.6.4-cp27-cp27m-macosx_10_10_intel.whl - # The PySide2 version is "5.6". - # The Qt version built against is "5.6.4". - qt_version = self.params['qt_version'] - package_version = self.params['package_version'] - wheel_version = "{}-{}".format(package_version, qt_version) - components = (_safer_name(self.distribution.get_name()), - wheel_version) - if self.build_number: - components += (self.build_number,) - return '-'.join(components) - - # Copy of get_tag from bdist_wheel.py, to allow setting a - # multi-python impl tag, by removing an assert. Otherwise we - # would have to rename wheels manually for limited api - # packages. Also we set "none" abi tag on Windows, because - # pip does not yet support "abi3" tag, leading to - # installation failure when tried. - def get_tag(self): - # bdist sets self.plat_name if unset, we should only use - # it for purepy wheels if the user supplied it. - if self.plat_name_supplied: - plat_name = self.plat_name - elif self.root_is_pure: - plat_name = 'any' +class PysideBuildWheel(_bdist_wheel): + def __init__(self, *args, **kwargs): + self.pyside_params = None + _bdist_wheel.__init__(self, *args, **kwargs) + + def finalize_options(self): + if sys.platform == 'darwin': + # Override the platform name to contain the correct + # minimum deployment target. + # This is used in the final wheel name. + self.plat_name = self.params['macos_plat_name'] + + # When limited API is requested, notify bdist_wheel to + # create a properly named package. + limited_api_enabled = OPTION_LIMITED_API and sys.version_info[0] >= 3 + if limited_api_enabled: + self.py_limited_api = "cp35.cp36.cp37" + + _bdist_wheel.finalize_options(self) + + @property + def wheel_dist_name(self): + # Slightly modified version of wheel's wheel_dist_name + # method, to add the Qt version as well. + # Example: + # PySide2-5.6-5.6.4-cp27-cp27m-macosx_10_10_intel.whl + # The PySide2 version is "5.6". + # The Qt version built against is "5.6.4". + qt_version = self.params['qt_version'] + package_version = self.params['package_version'] + wheel_version = "{}-{}".format(package_version, qt_version) + components = (_safer_name(self.distribution.get_name()), + wheel_version) + if self.build_number: + components += (self.build_number,) + return '-'.join(components) + + # Copy of get_tag from bdist_wheel.py, to allow setting a + # multi-python impl tag, by removing an assert. Otherwise we + # would have to rename wheels manually for limited api + # packages. Also we set "none" abi tag on Windows, because + # pip does not yet support "abi3" tag, leading to + # installation failure when tried. + def get_tag(self): + # bdist sets self.plat_name if unset, we should only use it for purepy + # wheels if the user supplied it. + if self.plat_name_supplied: + plat_name = self.plat_name + elif self.root_is_pure: + plat_name = 'any' + else: + plat_name = self.plat_name or wheel_get_platform() + if plat_name in ('linux-x86_64', 'linux_x86_64') and sys.maxsize == 2147483647: + plat_name = 'linux_i686' + + # To allow uploading to pypi, we need the wheel name + # to contain 'manylinux1'. + # The wheel which will be uploaded to pypi will be + # built on RHEL7, so it doesn't completely qualify for + # manylinux1 support, but it's the minimum requirement + # for building Qt. We only enable this for x64 limited + # api builds (which are the only ones uploaded to + # pypi). + # TODO: Add actual distro detection, instead of + # relying on limited_api option. + if plat_name in ('linux-x86_64', 'linux_x86_64') and sys.maxsize > 2147483647 \ + and self.py_limited_api: + plat_name = 'manylinux1_x86_64' + plat_name = plat_name.replace('-', '_').replace('.', '_') + + if self.root_is_pure: + if self.universal: + impl = 'py2.py3' else: - plat_name = self.plat_name or wheel_get_platform() - if plat_name in ('linux-x86_64', 'linux_x86_64') and sys.maxsize == 2147483647: - plat_name = 'linux_i686' - - # To allow uploading to pypi, we need the wheel name - # to contain 'manylinux1'. - # The wheel which will be uploaded to pypi will be - # built on RHEL7, so it doesn't completely qualify for - # manylinux1 support, but it's the minimum requirement - # for building Qt. We only enable this for x64 limited - # api builds (which are the only ones uploaded to - # pypi). - # TODO: Add actual distro detection, instead of - # relying on limited_api option. - if plat_name in ('linux-x86_64', 'linux_x86_64') and sys.maxsize > 2147483647 \ - and self.py_limited_api: - plat_name = 'manylinux1_x86_64' - plat_name = plat_name.replace('-', '_').replace('.', '_') - - if self.root_is_pure: - if self.universal: - impl = 'py2.py3' - else: - impl = self.python_tag - tag = (impl, 'none', plat_name) + impl = self.python_tag + tag = (impl, 'none', plat_name) + else: + impl_name = get_abbr_impl() + impl_ver = get_impl_ver() + impl = impl_name + impl_ver + # We don't work on CPython 3.1, 3.0. + if self.py_limited_api and (impl_name + impl_ver).startswith('cp3'): + impl = self.py_limited_api + abi_tag = "abi3" if sys.platform != "win32" else "none" else: - impl_name = get_abbr_impl() - impl_ver = get_impl_ver() - impl = impl_name + impl_ver - # We don't work on CPython 3.1, 3.0. - if self.py_limited_api and (impl_name + impl_ver).startswith('cp3'): - impl = self.py_limited_api - if sys.platform == "win32": - abi_tag = 'none' - else: - abi_tag = 'abi3' - else: - abi_tag = str(get_abi_tag()).lower() - tag = (impl, abi_tag, plat_name) - supported_tags = pep425tags.get_supported( - supplied_platform=plat_name if self.plat_name_supplied else None) - # XXX switch to this alternate implementation for - # non-pure: - if not self.py_limited_api: - assert tag == supported_tags[0], "%s != %s" % (tag, supported_tags[0]) - assert tag in supported_tags, \ - "would build wheel with unsupported tag {}".format(tag) - return tag - - # Copy of get_tag from bdist_wheel.py, to write a triplet Tag - # only once for the limited_api case. - def write_wheelfile(self, wheelfile_base, generator='bdist_wheel (' + wheel_version + ')'): - from email.message import Message - msg = Message() - msg['Wheel-Version'] = '1.0' # of the spec - msg['Generator'] = generator - msg['Root-Is-Purelib'] = str(self.root_is_pure).lower() - if self.build_number is not None: - msg['Build'] = self.build_number - - # Doesn't work for bdist_wininst - impl_tag, abi_tag, plat_tag = self.get_tag() - limited_api_enabled = OPTION_LIMITED_API and sys.version_info[0] >= 3 - - def writeTag(impl): - for abi in abi_tag.split('.'): - for plat in plat_tag.split('.'): - msg['Tag'] = '-'.join((impl, abi, plat)) - if limited_api_enabled: - writeTag(impl_tag) - else: - for impl in impl_tag.split('.'): - writeTag(impl) - - wheelfile_path = os.path.join(wheelfile_base, 'WHEEL') - log.info('creating %s', wheelfile_path) - with open(wheelfile_path, 'w') as f: - Generator(f, maxheaderlen=0).flatten(msg) - - def finalize_options(self): - if sys.platform == 'darwin': - # Override the platform name to contain the correct - # minimum deployment target. - # This is used in the final wheel name. - self.plat_name = self.params['macos_plat_name'] - - # When limited API is requested, notify bdist_wheel to - # create a properly named package. - limited_api_enabled = OPTION_LIMITED_API and sys.version_info[0] >= 3 - if limited_api_enabled: - self.py_limited_api = "cp35.cp36.cp37.cp38" - - _bdist_wheel.finalize_options(self) + abi_tag = str(get_abi_tag()).lower() + tag = (impl, abi_tag, plat_name) + supported_tags = pep425tags.get_supported( + supplied_platform=plat_name if self.plat_name_supplied else None) + # XXX switch to this alternate implementation for non-pure: + if not self.py_limited_api: + assert tag == supported_tags[0], "%s != %s" % (tag, supported_tags[0]) + assert tag in supported_tags, ( + "would build wheel with unsupported tag {}".format(tag)) + return tag + + # Copy of get_tag from bdist_wheel.py, to write a triplet Tag + # only once for the limited_api case. + def write_wheelfile(self, wheelfile_base, generator='bdist_wheel (' + wheel_version + ')'): + from email.message import Message + msg = Message() + msg['Wheel-Version'] = '1.0' # of the spec + msg['Generator'] = generator + msg['Root-Is-Purelib'] = str(self.root_is_pure).lower() + if self.build_number is not None: + msg['Build'] = self.build_number + + # Doesn't work for bdist_wininst + impl_tag, abi_tag, plat_tag = self.get_tag() + limited_api_enabled = OPTION_LIMITED_API and sys.version_info[0] >= 3 + + def writeTag(impl): + for abi in abi_tag.split('.'): + for plat in plat_tag.split('.'): + msg['Tag'] = '-'.join((impl, abi, plat)) + if limited_api_enabled: + writeTag(impl_tag) + else: + for impl in impl_tag.split('.'): + writeTag(impl) + + wheelfile_path = os.path.join(wheelfile_base, 'WHEEL') + logger.info('creating %s', wheelfile_path) + with open(wheelfile_path, 'w') as f: + Generator(f, maxheaderlen=0).flatten(msg) + + +if not wheel_module_exists: + del PysideBuildWheel + |