From d621f3f72637fef804e43075272f010bb6e6d874 Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Thu, 19 Nov 2020 09:51:19 +0300 Subject: [PATCH 1/8] Try to build wheels https://pypi.org/project/cibuildwheel/ --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index ede9273..b04e587 100644 --- a/.travis.yml +++ b/.travis.yml @@ -75,6 +75,7 @@ jobs: before_install: - bash ci-prepare-environment.bash + - python -m pip install cibuildwheel==1.6.4 install: - export PYICU_LIBRARIES="icui18n:icuuc:icudata" @@ -85,6 +86,9 @@ install: script: - LD_LIBRARY_PATH="$HOME/icu4c/lib" DYLD_LIBRARY_PATH="$HOME/icu4c/lib" py.test + # build the wheels, put them into './wheelhouse' + - python -m cibuildwheel --output-dir wheelhouse + cache: ccache: true From fbfb857a465016267fb149ce1786d8820072a9e5 Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Thu, 19 Nov 2020 10:22:24 +0300 Subject: [PATCH 2/8] Use separate stage for building wheels --- .travis.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index b04e587..a11e63d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -73,9 +73,14 @@ jobs: - {arch: arm64, env: ICU_VERSION=55.2, python: 3.9} - {arch: arm64, env: ICU_VERSION=68.1, python: 3.9} + - stage: build wheels + install: python3 -m pip install cibuildwheel==1.6.4 + script: + # build the wheels, put them into './wheelhouse' + - python -m cibuildwheel --output-dir wheelhouse + before_install: - bash ci-prepare-environment.bash - - python -m pip install cibuildwheel==1.6.4 install: - export PYICU_LIBRARIES="icui18n:icuuc:icudata" @@ -86,8 +91,6 @@ install: script: - LD_LIBRARY_PATH="$HOME/icu4c/lib" DYLD_LIBRARY_PATH="$HOME/icu4c/lib" py.test - # build the wheels, put them into './wheelhouse' - - python -m cibuildwheel --output-dir wheelhouse cache: From de5355af2a90c96c896b13ed08ffdeb446baeefb Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Thu, 19 Nov 2020 10:23:02 +0300 Subject: [PATCH 3/8] Python3 is neede for cibuildwheel --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a11e63d..736b726 100644 --- a/.travis.yml +++ b/.travis.yml @@ -77,7 +77,7 @@ jobs: install: python3 -m pip install cibuildwheel==1.6.4 script: # build the wheels, put them into './wheelhouse' - - python -m cibuildwheel --output-dir wheelhouse + - python3 -m cibuildwheel --output-dir wheelhouse before_install: - bash ci-prepare-environment.bash From eb34e52c3f58e7b97025ea8ef387a584e1073d32 Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Thu, 19 Nov 2020 11:09:43 +0300 Subject: [PATCH 4/8] Use latest ICU 68.1 for Python wheels --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 736b726..2105574 100644 --- a/.travis.yml +++ b/.travis.yml @@ -74,6 +74,7 @@ jobs: - {arch: arm64, env: ICU_VERSION=68.1, python: 3.9} - stage: build wheels + env: ICU_VERSION=68.1 install: python3 -m pip install cibuildwheel==1.6.4 script: # build the wheels, put them into './wheelhouse' @@ -92,7 +93,6 @@ install: script: - LD_LIBRARY_PATH="$HOME/icu4c/lib" DYLD_LIBRARY_PATH="$HOME/icu4c/lib" py.test - cache: ccache: true pip: true From 0d1c435395c54c828895e301600eb707fb1de42c Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Thu, 19 Nov 2020 19:06:07 +0300 Subject: [PATCH 5/8] Pass the environment to the wheel build system --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2105574..e1c8d1c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -74,7 +74,8 @@ jobs: - {arch: arm64, env: ICU_VERSION=68.1, python: 3.9} - stage: build wheels - env: ICU_VERSION=68.1 + env: + - CIBW_ENVIRONMENT="ICU_VERSION=68.1" install: python3 -m pip install cibuildwheel==1.6.4 script: # build the wheels, put them into './wheelhouse' From 1b4be7b4a4b336252c51dd33b53bb46308a54e7b Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Thu, 19 Nov 2020 20:37:04 +0300 Subject: [PATCH 6/8] Ignore `before_install` for wheels Builds are made in a container, no purpose of installing ICU there --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index e1c8d1c..2ca1ace 100644 --- a/.travis.yml +++ b/.travis.yml @@ -74,8 +74,9 @@ jobs: - {arch: arm64, env: ICU_VERSION=68.1, python: 3.9} - stage: build wheels - env: - - CIBW_ENVIRONMENT="ICU_VERSION=68.1" + #env: + # - CIBW_ENVIRONMENT="ICU_VERSION=68.1" + before_install: ignore install: python3 -m pip install cibuildwheel==1.6.4 script: # build the wheels, put them into './wheelhouse' From b8ddd4cbbaf8bb30e43ab0fa7c94b1276fd8c69a Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Thu, 19 Nov 2020 23:47:47 +0300 Subject: [PATCH 7/8] Execute install script for wheel inside build env https://cibuildwheel.readthedocs.io/en/stable/options/#before-all --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2ca1ace..15eeb25 100644 --- a/.travis.yml +++ b/.travis.yml @@ -74,8 +74,9 @@ jobs: - {arch: arm64, env: ICU_VERSION=68.1, python: 3.9} - stage: build wheels - #env: - # - CIBW_ENVIRONMENT="ICU_VERSION=68.1" + env: + - CIBW_ENVIRONMENT="ICU_VERSION=68.1" + - CIBW_BEFORE_ALL="bash ci-prepare-environment.bash" before_install: ignore install: python3 -m pip install cibuildwheel==1.6.4 script: From 45bb88bd1de0dcdd4b067c08c47bbab1b51e6680 Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Fri, 20 Nov 2020 09:14:54 +0300 Subject: [PATCH 8/8] Use CI indepedent checks for preparation --- ci-prepare-environment.bash | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/ci-prepare-environment.bash b/ci-prepare-environment.bash index f4cf5fd..81cd1e3 100644 --- a/ci-prepare-environment.bash +++ b/ci-prepare-environment.bash @@ -4,6 +4,13 @@ set -e # set -x # turn on for debugging +case "$OSTYPE" in + darwin*) OS=osx ;; + linux*) OS=linux ;; + msys*) OS=windows ;; + *) OS="unknown: $OSTYPE" ;; +esac + ####### # Tools @@ -23,13 +30,13 @@ function fetch_icu { else local icu_url="https://github.com/unicode-org/icu/releases/download/release-${version/rc/-rc}/icu4c-${version}-src.tgz" fi - if [ "${TRAVIS_OS_NAME}" = windows ]; then icu_url="${icu_url%.tgz}.zip"; fi + if [ "${OS}" = windows ]; then icu_url="${icu_url%.tgz}.zip"; fi local src="${location}/${icu_url##*/}" # Download, then use different extraction tools on Windows vs. otherwise mkdir -p "${location}" wget -nv -O "${src}" "${icu_url}" - if [ "${TRAVIS_OS_NAME?}" = windows ] + if [ "${OS?}" = windows ] then 7z x "${src}" -o"${location}" else @@ -57,10 +64,10 @@ install_dir="$HOME/icu4c" build_dir="$HOME/build" # This will be used to uniquely determine if the correct cache is found or not. -cache_tag="${install_dir}/icu4c-${TRAVIS_OS_NAME?}-${ICU_VERSION}.done" +cache_tag="${install_dir}/icu4c-${OS?}-${ICU_VERSION}.done" # The platform is used by runConfigureICU to determine what flags to set. -case "${TRAVIS_OS_NAME}" in +case "${OS}" in osx) platform=MacOSX;; windows) platform=Cygwin/MSVC ;; *) platform=Linux ;; @@ -98,7 +105,7 @@ echo "ICU VERSION: ${ICU_VERSION}" # Logic # Need to install Python on macos and windows (annoyingly). -case "${TRAVIS_OS_NAME}" in +case "${OS}" in osx) install_python_osx "${pyver}";; windows) @@ -113,7 +120,7 @@ else echo "Build and install ICU from source..." fetch_icu "${ICU_VERSION}" "${build_dir}" - if [ "${TRAVIS_OS_NAME}" = windows ] + if [ "${OS}" = windows ] then # XXX: As-is, this seems to be broken and does not work. # It is unknown to me how to solve this at this time.