diff --git a/.travis.yml b/.travis.yml index 785661d8f..8152f9766 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,11 +15,13 @@ matrix: language: generic env: - PYTHON_VERSION=3.7.9 + - MACOSX_DEPLOYMENT_TARGET=10.10 - os: osx language: generic env: - PYTHON_VERSION=2.7.18 + - MACOSX_DEPLOYMENT_TARGET=10.10 - arch: arm64-graviton2 virt: vm diff --git a/CMakeLists.txt b/CMakeLists.txt index 7805a8c08..e786f3d94 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,7 +66,11 @@ if(CMakePythonDistributions_SUPERBUILD) set(binary_archive "linux64_binary") endif() if(APPLE) - set(binary_archive "macosx_binary") + if("${CMAKE_OSX_DEPLOYMENT_TARGET}" VERSION_LESS "10.10") + message(FATAL_ERROR "Unsupported macOS deployment target: ${CMAKE_OSX_DEPLOYMENT_TARGET} is less than 10.10") + else() + set(binary_archive "macos10_10_binary") + endif() endif() if(WIN32) set(binary_archive "win32_binary") diff --git a/CMakeUrls.cmake b/CMakeUrls.cmake index ef6b82075..a5b61b3ae 100644 --- a/CMakeUrls.cmake +++ b/CMakeUrls.cmake @@ -1,26 +1,26 @@ #----------------------------------------------------------------------------- # CMake sources -set(unix_source_url "https://github.com/Kitware/CMake/releases/download/v3.19.1/cmake-3.19.1.tar.gz") -set(unix_source_sha256 "1d266ea3a76ef650cdcf16c782a317cb4a7aa461617ee941e389cb48738a3aba") +set(unix_source_url "https://github.com/Kitware/CMake/releases/download/v3.20.2/cmake-3.20.2.tar.gz") +set(unix_source_sha256 "aecf6ecb975179eb3bb6a4a50cae192d41e92b9372b02300f9e8f1d5f559544e") -set(windows_source_url "https://github.com/Kitware/CMake/releases/download/v3.19.1/cmake-3.19.1.zip") -set(windows_source_sha256 "d3c8fc07b3207c6826b49e46b8194fcdbaab95eaba75dd735e348230efd4400d") +set(windows_source_url "https://github.com/Kitware/CMake/releases/download/v3.20.2/cmake-3.20.2.zip") +set(windows_source_sha256 "70c6fcb80adfc7aa2969c7b1fd020381ea528d06f3c2aab546f4c2407ed5d148") #----------------------------------------------------------------------------- # CMake binaries -set(linux32_binary_url "NA") # Linux 32-bit binaries not available -set(linux32_binary_sha256 "NA") +set(linux32_binary_url "NA") # Linux 32-bit binaries not available +set(linux32_binary_sha256 "NA") -set(linux64_binary_url "https://github.com/Kitware/CMake/releases/download/v3.19.1/cmake-3.19.1-Linux-x86_64.tar.gz") -set(linux64_binary_sha256 "587fb2d882214511f4b260329800de7903eba7827498f06a0dee234ed579bdc3") +set(linux64_binary_url "https://github.com/Kitware/CMake/releases/download/v3.20.2/cmake-3.20.2-linux-x86_64.tar.gz") +set(linux64_binary_sha256 "3f827544f9c82e74ddf5016461fdfcfea4ede58a26f82612f473bf6bfad8bfc2") -set(macosx_binary_url "https://github.com/Kitware/CMake/releases/download/v3.19.1/cmake-3.19.1-Darwin-x86_64.tar.gz") -set(macosx_binary_sha256 "8b1caf1da7bc738a27c820ca8dc2ddb610b7526b4507095de87d79cd5a27028b") +set(macos10_10_binary_url "https://github.com/Kitware/CMake/releases/download/v3.20.2/cmake-3.20.2-macos10.10-universal.tar.gz") +set(macos10_10_binary_sha256 "6d9c1c1aecb61d085b1a20503fa94b0c28abae617e20189df61eea4cf876fba0") -set(win32_binary_url "https://github.com/Kitware/CMake/releases/download/v3.19.1/cmake-3.19.1-win32-x86.zip") -set(win32_binary_sha256 "7c01b9cc29a0e5051c11c605b7dd43d187fb25b277e7a3dc4085b9eaf36a0387") +set(win32_binary_url "https://github.com/Kitware/CMake/releases/download/v3.20.2/cmake-3.20.2-windows-i386.zip") +set(win32_binary_sha256 "8ad1f1f9a1a0a0dc82107eb9a4351d91d4e72504b0343368f1569b72a5e48bc1") -set(win64_binary_url "https://github.com/Kitware/CMake/releases/download/v3.19.1/cmake-3.19.1-win64-x64.zip") -set(win64_binary_sha256 "e95d70549f306adb46e0f131dcecdbcbc6412d3a1e073c2c0078812391bf21d3") +set(win64_binary_url "https://github.com/Kitware/CMake/releases/download/v3.20.2/cmake-3.20.2-windows-x86_64.zip") +set(win64_binary_sha256 "15a49e2ab81c1822d75b1b1a92f7863f58e31f6d6aac1c4103eef2b071be3112") diff --git a/README.rst b/README.rst index 77ecd9c24..2eb854cf0 100644 --- a/README.rst +++ b/README.rst @@ -11,7 +11,7 @@ The suite of CMake tools were created by Kitware in response to the need for a powerful, cross-platform build environment for open-source projects such as ITK and VTK. -The CMake python wheels provide `CMake 3.19.1 `_. +The CMake python wheels provide `CMake 3.20.2 `_. Latest Release -------------- diff --git a/docs/index.rst b/docs/index.rst index 8d7747fcc..edcb1b4f2 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -15,7 +15,7 @@ The suite of CMake tools were created by Kitware in response to the need for a powerful, cross-platform build environment for open-source projects such as `ITK `_ and `VTK `_. -The CMake python wheels provide `CMake 3.19.1 `_. +The CMake python wheels provide `CMake 3.20.2 `_. .. toctree:: :maxdepth: 2 diff --git a/scikit-ci.yml b/scikit-ci.yml index db993f4f5..5b29ba60e 100644 --- a/scikit-ci.yml +++ b/scikit-ci.yml @@ -39,7 +39,7 @@ before_install: osx: environment: PATH: $/.pyenv/versions/$/bin:$ - SETUP_BDIST_WHEEL_ARGS: --plat-name macosx-10.6-x86_64 + SETUP_BDIST_WHEEL_ARGS: --plat-name macosx-$-x86_64 commands: - python scripts/ssl-check.py - python ../addons/travis/install_cmake.py 3.12.0 @@ -59,7 +59,7 @@ before_install: if platform.machine() in {"ppc64le"}: # the container sees all 16 threads but building with all of them # triggers the OoM killer due to RAM limitations - os.environ["SETUP_MAKE_ARGS"] = "-j4" + os.environ["SETUP_MAKE_ARGS"] = "-j2" else: os.environ["SETUP_MAKE_ARGS"] = "-j$(nproc)" ci.driver.Driver.save_env(os.environ) @@ -117,12 +117,29 @@ test: commands: # Convert to generic platform wheel - python: | - import glob, sys + import glob, os, sys sys.path.insert(0, "./scripts") from convert_to_generic_platform_wheel import convert_to_generic_platform_wheel wheels = glob.glob("dist/*.whl") + additional_platforms = [] + if "MACOSX_DEPLOYMENT_TARGET" in os.environ: + target = tuple(int(p) for p in os.environ["MACOSX_DEPLOYMENT_TARGET"].split(".")) + # let's add universal2 platform for this wheel. + additional_platforms = ["macosx_{}_{}_universal2".format(*target)] + + # given pip support for universal2 was added after arm64 introduction + # let's also add arm64 platform. + arm64_target = target + if arm64_target < (11, 0): + arm64_target = (11, 0) + additional_platforms.append("macosx_{}_{}_arm64".format(*arm64_target)) + + if target < (11, 0): + # They're were also issues with pip not picking up some universal2 wheels, tag twice + additional_platforms.append("macosx_11_0_universal2") + for wheel in wheels: - convert_to_generic_platform_wheel(wheel, remove_original=True) + convert_to_generic_platform_wheel(wheel, remove_original=True, additional_platforms=additional_platforms) appveyor: commands: diff --git a/scripts/convert_to_generic_platform_wheel.py b/scripts/convert_to_generic_platform_wheel.py index 10d737ff0..cc1de1f80 100644 --- a/scripts/convert_to_generic_platform_wheel.py +++ b/scripts/convert_to_generic_platform_wheel.py @@ -41,7 +41,7 @@ def _to_generic_pyver(pyver_tags): return ['py%s' % tag[2] if tag.startswith('cp') else tag for tag in pyver_tags] -def _convert_to_generic_platform_wheel(wheel_ctx): +def _convert_to_generic_platform_wheel(wheel_ctx, additional_platforms): """Switch to generic python tags and remove ABI tags from a wheel Convert implementation specific python tags to their generic equivalent and @@ -51,6 +51,8 @@ def _convert_to_generic_platform_wheel(wheel_ctx): ---------- wheel_ctx : InWheelCtx An open wheel context + additional_platforms : Optional[Iterable[str]] + An optional iterable of additional platform to add to the wheel """ abi_tags = ['none'] @@ -69,7 +71,14 @@ def _convert_to_generic_platform_wheel(wheel_ctx): # Update wheel filename fparts = wf.parsed_filename.groupdict() - original_platform_tags = fparts['plat'].split('.') + platform_tags = fparts['plat'].split('.') + logger.debug('Previous platform tags: %s', ', '.join(platform_tags)) + if additional_platforms: + platform_tags = list(sorted(set(platform_tags + [p for p in additional_platforms]))) + fparts['plat'] = '.'.join(platform_tags) + logger.debug('New platform tags ....: %s', ', '.join(platform_tags)) + else: + logger.debug('No platform tags change needed.') original_abi_tags = fparts['abi'].split('.') logger.debug('Previous ABI tags: %s', ', '.join(original_abi_tags)) @@ -114,7 +123,7 @@ def _convert_to_generic_platform_wheel(wheel_ctx): pyc_apis = unique_by_index(pyc_apis) # Set tags for each Python version, C-API combination - updated_tags = ['-'.join(tup) for tup in product(pyc_apis, original_platform_tags)] + updated_tags = ['-'.join(tup) for tup in product(pyc_apis, platform_tags)] if updated_tags != in_info_tags: del info['Tag'] @@ -128,7 +137,8 @@ def _convert_to_generic_platform_wheel(wheel_ctx): return out_wheel -def convert_to_generic_platform_wheel(wheel_path, out_dir='./dist/', remove_original=False, verbose=0): +def convert_to_generic_platform_wheel(wheel_path, out_dir='./dist/', remove_original=False, verbose=0, + additional_platforms=None): logging.disable(logging.NOTSET) if verbose >= 1: logging.basicConfig(level=logging.DEBUG) @@ -140,7 +150,7 @@ def convert_to_generic_platform_wheel(wheel_path, out_dir='./dist/', remove_orig with InWheelCtx(wheel_path) as ctx: ctx.out_wheel = pjoin(out_dir, wheel_fname) - ctx.out_wheel = _convert_to_generic_platform_wheel(ctx) + ctx.out_wheel = _convert_to_generic_platform_wheel(ctx, additional_platforms) if remove_original: logger.info('Removed original wheel %s' % wheel_path) diff --git a/scripts/update_cmake_version.py b/scripts/update_cmake_version.py index 0fee33b64..348a1d3ae 100644 --- a/scripts/update_cmake_version.py +++ b/scripts/update_cmake_version.py @@ -43,12 +43,12 @@ def get_cmake_archive_urls_and_sha256s(version, verbose=False): sha_256_file = "cmake-%s-SHA-256.txt" % version expected_files = { - "cmake-%s.tar.gz" % version: "unix_source", - "cmake-%s.zip" % version: "win_source", - "cmake-%s-Linux-x86_64.tar.gz" % version: "linux64_binary", - "cmake-%s-Darwin-x86_64.tar.gz" % version: "macosx_binary", - "cmake-%s-win32-x86.zip" % version: "win32_binary", - "cmake-%s-win64-x64.zip" % version: "win64_binary", + "cmake-%s.tar.gz" % version: "unix_source", + "cmake-%s.zip" % version: "win_source", + "cmake-%s-linux-x86_64.tar.gz" % version: "linux64_binary", + "cmake-%s-macos10.10-universal.tar.gz" % version: "macos10_10_binary", + "cmake-%s-windows-i386.zip" % version: "win32_binary", + "cmake-%s-windows-x86_64.zip" % version: "win64_binary", } # Get SHA256s for each asset @@ -102,29 +102,29 @@ def generate_cmake_variables(urls_and_sha256s): cmake_variables = textwrap.dedent(""" #----------------------------------------------------------------------------- # CMake sources - set(unix_source_url "{unix_source_url}") - set(unix_source_sha256 "{unix_source_sha256}") + set(unix_source_url "{unix_source_url}") + set(unix_source_sha256 "{unix_source_sha256}") - set(windows_source_url "{win_source_url}") - set(windows_source_sha256 "{win_source_sha256}") + set(windows_source_url "{win_source_url}") + set(windows_source_sha256 "{win_source_sha256}") #----------------------------------------------------------------------------- # CMake binaries - set(linux32_binary_url "NA") # Linux 32-bit binaries not available - set(linux32_binary_sha256 "NA") + set(linux32_binary_url "NA") # Linux 32-bit binaries not available + set(linux32_binary_sha256 "NA") - set(linux64_binary_url "{linux64_binary_url}") - set(linux64_binary_sha256 "{linux64_binary_sha256}") + set(linux64_binary_url "{linux64_binary_url}") + set(linux64_binary_sha256 "{linux64_binary_sha256}") - set(macosx_binary_url "{macosx_binary_url}") - set(macosx_binary_sha256 "{macosx_binary_sha256}") + set(macos10_10_binary_url "{macos10_10_binary_url}") + set(macos10_10_binary_sha256 "{macos10_10_binary_sha256}") - set(win32_binary_url "{win32_binary_url}") - set(win32_binary_sha256 "{win32_binary_sha256}") + set(win32_binary_url "{win32_binary_url}") + set(win32_binary_sha256 "{win32_binary_sha256}") - set(win64_binary_url "{win64_binary_url}") - set(win64_binary_sha256 "{win64_binary_sha256}") + set(win64_binary_url "{win64_binary_url}") + set(win64_binary_sha256 "{win64_binary_sha256}") """).format(**template_inputs) return cmake_variables diff --git a/tests/test_distribution.py b/tests/test_distribution.py index 773913771..f940be83a 100644 --- a/tests/test_distribution.py +++ b/tests/test_distribution.py @@ -9,7 +9,7 @@ def _check_cmake_install(virtualenv, tmpdir): - expected_version = "3.19.1" + expected_version = "3.20.2" for executable_name in ["cmake", "cpack", "ctest"]: output = virtualenv.run(