From 184270d7540ba5de12f7518f77c9b5a3e857d6c0 Mon Sep 17 00:00:00 2001 From: Mike Taves Date: Sun, 14 Jul 2024 00:19:46 +1200 Subject: [PATCH] CI/BLD: move CIBW commands to pyproject.toml, move scripts (#328) * CI/BLD: move CIBW commands to pyproject.toml, move scripts * Use shasum on macOS, use = for POSIX compliance --------- Co-authored-by: Adam J. Stewart --- .github/workflows/deploy.yml | 9 --------- pyproject.toml | 10 +++++++--- {ci => scripts}/install_libspatialindex.bat | 0 .../install_libspatialindex.sh | 11 ++++++++--- 4 files changed, 15 insertions(+), 15 deletions(-) rename {ci => scripts}/install_libspatialindex.bat (100%) mode change 100755 => 100644 rename ci/install_libspatialindex.bash => scripts/install_libspatialindex.sh (87%) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 529caaa1..6b4898cf 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -34,18 +34,9 @@ jobs: with: python-version: '3.11' - - name: Setup - run: pip install wheel - - uses: ilammy/msvc-dev-cmd@v1 if: startsWith(matrix.os, 'windows') - - name: Run Windows Preinstall Build - if: startsWith(matrix.os, 'windows') - run: | - choco install vcpython27 -f -y - ci\install_libspatialindex.bat - - name: Build wheels uses: pypa/cibuildwheel@v2.19.2 diff --git a/pyproject.toml b/pyproject.toml index 8c78e209..cd32a1bb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,6 +50,7 @@ rtree = ["py.typed"] [tool.cibuildwheel] build = "cp39-*" build-verbosity = 3 +before-all = "pip install wheel" repair-wheel-command = "python scripts/repair_wheel.py -w {dest_dir} {wheel}" test-requires = "tox" test-command = "tox --conf {project} --installpkg {wheel}" @@ -62,14 +63,14 @@ test-skip = [ archs = ["auto", "aarch64"] before-build = [ "yum install -y cmake libffi-devel", - "bash {project}/ci/install_libspatialindex.bash", + "sh {project}/scripts/install_libspatialindex.sh", ] [[tool.cibuildwheel.overrides]] select = "*-musllinux*" before-build = [ "apk add cmake libffi-dev", - "bash {project}/ci/install_libspatialindex.bash", + "sh {project}/scripts/install_libspatialindex.sh", ] [tool.cibuildwheel.macos] @@ -77,11 +78,14 @@ archs = ["x86_64", "arm64"] environment = { MACOSX_DEPLOYMENT_TARGET="10.9" } before-build = [ "brew install coreutils cmake", - "bash {project}/ci/install_libspatialindex.bash", + "sh {project}/scripts/install_libspatialindex.sh", ] [tool.cibuildwheel.windows] archs = ["AMD64"] +before-build = [ + "call {project}\\scripts\\install_libspatialindex.bat", +] [tool.coverage.report] # Ignore warnings for overloads diff --git a/ci/install_libspatialindex.bat b/scripts/install_libspatialindex.bat old mode 100755 new mode 100644 similarity index 100% rename from ci/install_libspatialindex.bat rename to scripts/install_libspatialindex.bat diff --git a/ci/install_libspatialindex.bash b/scripts/install_libspatialindex.sh similarity index 87% rename from ci/install_libspatialindex.bash rename to scripts/install_libspatialindex.sh index 50084035..e4fd4c7c 100755 --- a/ci/install_libspatialindex.bash +++ b/scripts/install_libspatialindex.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh set -xe # A simple script to install libspatialindex from a Github Release @@ -32,7 +32,12 @@ rm -f $VERSION.zip curl -LOs --retry 5 --retry-max-time 120 https://github.com/libspatialindex/libspatialindex/archive/${VERSION}.zip # check the file hash -echo "${SHA256} ${VERSION}.zip" | sha256sum -c - +if [ "$(uname)" = "Darwin" ] +then + echo "${SHA256} ${VERSION}.zip" | shasum -a 256 -c - +else + echo "${SHA256} ${VERSION}.zip" | sha256sum -c - +fi rm -rf "libspatialindex-${VERSION}" unzip -q $VERSION @@ -43,7 +48,7 @@ cd build printenv -if [ "$(uname)" == "Darwin" ]; then +if [ "$(uname)" = "Darwin" ]; then CMAKE_ARGS="-D CMAKE_OSX_ARCHITECTURES=${ARCHFLAGS##* } \ -D CMAKE_INSTALL_RPATH=@loader_path" fi