From 454220d9e9365d3d4f9316efe0dd5cabd16ccd74 Mon Sep 17 00:00:00 2001 From: Iain Russell Date: Tue, 8 Jul 2025 15:30:03 +0100 Subject: [PATCH 1/2] ECC-2106: depend on eccodeslib --- .github/workflows/build-wheel-linux.yml | 154 ---------------------- .github/workflows/build-wheel-macos.yml | 168 ------------------------ .github/workflows/cd.yml | 8 +- README.rst | 60 ++++++--- gribapi/bindings.py | 2 +- scripts/build-linux.sh | 103 --------------- scripts/build-macos.sh | 80 ----------- scripts/select-python-linux.sh | 25 ---- scripts/select-python-macos.sh | 23 ---- scripts/test-linux.sh | 30 ----- scripts/test-macos.sh | 39 ------ scripts/wheel-linux.sh | 40 ------ scripts/wheel-macos.sh | 101 -------------- setup.py | 2 +- 14 files changed, 47 insertions(+), 788 deletions(-) delete mode 100644 .github/workflows/build-wheel-linux.yml delete mode 100644 .github/workflows/build-wheel-macos.yml delete mode 100755 scripts/build-linux.sh delete mode 100755 scripts/build-macos.sh delete mode 100755 scripts/select-python-linux.sh delete mode 100755 scripts/select-python-macos.sh delete mode 100755 scripts/test-linux.sh delete mode 100755 scripts/test-macos.sh delete mode 100755 scripts/wheel-linux.sh delete mode 100755 scripts/wheel-macos.sh diff --git a/.github/workflows/build-wheel-linux.yml b/.github/workflows/build-wheel-linux.yml deleted file mode 100644 index cf1c0c0..0000000 --- a/.github/workflows/build-wheel-linux.yml +++ /dev/null @@ -1,154 +0,0 @@ -# (C) Copyright 2024- ECMWF. -# -# This software is licensed under the terms of the Apache Licence Version 2.0 -# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# In applying this licence, ECMWF does not waive the privileges and immunities -# granted to it by virtue of its status as an intergovernmental organisation -# nor does it submit to any jurisdiction. - - -name: Build Linux - -on: - # Trigger the workflow manually - workflow_dispatch: ~ - - # Allow to be called from another workflow - workflow_call: ~ - - # repository_dispatch: - # types: [eccodes-updated] - - push: - tags-ignore: - - '**' - paths: - - 'scripts/common.sh' - - 'scripts/select-python-linux.sh' - - 'scripts/wheel-linux.sh' - - 'scripts/build-linux.sh' - - 'scripts/test-linux.sh' - - 'scripts/copy-licences.py' - - '.github/workflows/build-wheel-linux.yml' - -# to allow the action to run on the manylinux docker image based on CentOS 7 -env: - ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true - -jobs: - - build: - - # if: false # for temporarily disabling for debugging - - runs-on: [self-hosted, Linux, platform-builder-Rocky-8.6] - container: - image: dockcross/manylinux_2_28-x64:20250109-7bf589c - #options: --pull always - - name: Build manylinux_2_28-x64 - - steps: - - uses: actions/checkout@v4 - - - run: ./scripts/build-linux.sh - - # ################################################################ - - run: ./scripts/wheel-linux.sh 3.9 - - uses: actions/upload-artifact@v4 - name: Upload wheel 3.9 - with: - name: wheel-manylinux2014-3.9 - path: wheelhouse/*.whl - - # ################################################################ - - run: ./scripts/wheel-linux.sh 3.10 - - uses: actions/upload-artifact@v4 - name: Upload wheel 3.10 - with: - name: wheel-manylinux2014-3.10 - path: wheelhouse/*.whl - - # ################################################################ - - run: ./scripts/wheel-linux.sh 3.11 - - uses: actions/upload-artifact@v4 - name: Upload wheel 3.11 - with: - name: wheel-manylinux2014-3.11 - path: wheelhouse/*.whl - - # ################################################################ - - run: ./scripts/wheel-linux.sh 3.12 - - uses: actions/upload-artifact@v4 - name: Upload wheel 3.12 - with: - name: wheel-manylinux2014-3.12 - path: wheelhouse/*.whl - - # ################################################################ - - run: ./scripts/wheel-linux.sh 3.13 - - uses: actions/upload-artifact@v4 - name: Upload wheel 3.13 - with: - name: wheel-manylinux2014-3.13 - path: wheelhouse/*.whl - - test: - - needs: build - - strategy: - fail-fast: false - matrix: # We don't test 3.6, as it is not supported anymore by github actions - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] - - runs-on: [self-hosted, Linux, platform-builder-Rocky-8.6] - - name: Test with ${{ matrix.python-version }} - - steps: - - - uses: actions/checkout@v4 - - - uses: actions/download-artifact@v4 - with: - name: wheel-manylinux2014-${{ matrix.python-version }} - - - run: ./scripts/test-linux.sh ${{ matrix.python-version }} - - - deploy: - - if: ${{ github.ref_type == 'tag' || github.event_name == 'release' }} - - strategy: - fail-fast: false - matrix: - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] - - needs: [test, build] - - name: Deploy wheel ${{ matrix.python-version }} - - runs-on: [self-hosted, Linux, platform-builder-Rocky-8.6] - - - steps: - - - run: mkdir artifact-${{ matrix.python-version }} - - - uses: actions/checkout@v4 - - - uses: actions/download-artifact@v4 - with: - name: wheel-manylinux2014-${{ matrix.python-version }} - path: artifact-${{ matrix.python-version }} - - - run: | - source ./scripts/select-python-linux.sh 3.10 - pip3 install twine - ls -l artifact-${{ matrix.python-version }}/*.whl - twine upload artifact-${{ matrix.python-version }}/*.whl - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/build-wheel-macos.yml b/.github/workflows/build-wheel-macos.yml deleted file mode 100644 index cd6c1a3..0000000 --- a/.github/workflows/build-wheel-macos.yml +++ /dev/null @@ -1,168 +0,0 @@ -# (C) Copyright 2024- ECMWF. -# -# This software is licensed under the terms of the Apache Licence Version 2.0 -# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# In applying this licence, ECMWF does not waive the privileges and immunities -# granted to it by virtue of its status as an intergovernmental organisation -# nor does it submit to any jurisdiction. - -name: Build MacOS ARM - -on: - # Trigger the workflow manually - workflow_dispatch: ~ - - # allow to be called from another workflow - workflow_call: ~ - - # repository_dispatch: - # types: [eccodes-updated] - - push: - tags-ignore: - - '**' - paths: - - 'scripts/common.sh' - - 'scripts/select-python-macos.sh' - - 'scripts/build-macos.sh' - - 'scripts/wheel-macos.sh' - - 'scripts/test-macos.sh' - - 'scripts/copy-licences.py' - - '.github/workflows/build-wheel-macos.yml' - -# We don't use "actions/setup-python@v4" as it installs a universal python -# which creates universal wheels. We want to create wheels for the specific -# architecture we are running on. - -jobs: - - build: - - # if: false # for temporarily disabling for debugging - - strategy: - matrix: - arch_type: [ARM64, X64] - runs-on: [self-hosted, macOS, "${{ matrix.arch_type }}"] - - name: Build - - steps: - - - run: sudo mkdir -p /Users/runner - - run: sudo chown administrator:staff /Users/runner - - - uses: actions/checkout@v2 - - - run: ./scripts/build-macos.sh "3.10" - - - run: ./scripts/wheel-macos.sh "3.9" - - run: ls -l wheelhouse - - uses: actions/upload-artifact@v4 - name: Upload wheel 3.9 ${{ matrix.arch_type }} - with: - name: wheel-macos-${{ matrix.arch_type }}-3.9 - path: wheelhouse/*.whl - - run: rm -fr wheelhouse - - - run: ./scripts/wheel-macos.sh "3.10" - - run: ls -l wheelhouse - - uses: actions/upload-artifact@v4 - name: Upload wheel 3.10 ${{ matrix.arch_type }} - with: - name: wheel-macos-${{ matrix.arch_type }}-3.10 - path: wheelhouse/*.whl - - run: rm -fr wheelhouse - - - run: ./scripts/wheel-macos.sh "3.11" - - run: ls -l wheelhouse - - uses: actions/upload-artifact@v4 - name: Upload wheel 3.11 ${{ matrix.arch_type }} - with: - name: wheel-macos-${{ matrix.arch_type }}-3.11 - path: wheelhouse/*.whl - - run: rm -fr wheelhouse - - - run: ./scripts/wheel-macos.sh "3.12" - - run: ls -l wheelhouse - - uses: actions/upload-artifact@v4 - name: Upload wheel 3.12 ${{ matrix.arch_type }} - with: - name: wheel-macos-${{ matrix.arch_type }}-3.12 - path: wheelhouse/*.whl - - run: rm -fr wheelhouse - - - run: ./scripts/wheel-macos.sh "3.13" - - run: ls -l wheelhouse - - uses: actions/upload-artifact@v4 - name: Upload wheel 3.13 ${{ matrix.arch_type }} - with: - name: wheel-macos-${{ matrix.arch_type }}-3.13 - path: wheelhouse/*.whl - - run: rm -fr wheelhouse - - test: - needs: build - - strategy: - fail-fast: true - max-parallel: 1 - matrix: - arch_type: [ARM64, X64] - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] - - runs-on: [self-hosted, macOS, "${{ matrix.arch_type }}"] - - name: Test with Python ${{ matrix.python-version }} ${{ matrix.arch_type }} - - steps: - - - uses: actions/checkout@v2 - - - uses: actions/download-artifact@v4 - with: - name: wheel-macos-${{ matrix.arch_type }}-${{ matrix.python-version }} - - - run: ./scripts/test-macos.sh ${{ matrix.python-version }} - - - deploy: - - if: ${{ github.ref_type == 'tag' || github.event_name == 'release' }} - - needs: [test, build] - - name: Deploy wheel ${{ matrix.python-version }} ${{ matrix.arch_type }} - - strategy: - fail-fast: true - max-parallel: 1 - matrix: - arch_type: [ARM64, X64] - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] - - runs-on: [self-hosted, macOS, "${{ matrix.arch_type }}"] - - steps: - - - run: mkdir artifact-${{ matrix.arch_type }}-${{ matrix.python-version }} - - - uses: actions/checkout@v4 - - - uses: actions/download-artifact@v4 - with: - name: wheel-macos-${{ matrix.arch_type }}-${{ matrix.python-version }} - path: artifact-${{ matrix.arch_type }}-${{ matrix.python-version }} - - - run: | - source ./scripts/select-python-macos.sh ${{ matrix.python-version }} - VENV_DIR=./dist_venv_${{ matrix.python-version }} - rm -rf ${VENV_DIR} - python3 -m venv ${VENV_DIR} - source ${VENV_DIR}/bin/activate - pip3 install twine - ls -l artifact-${{ matrix.arch_type }}-${{ matrix.python-version }}/*.whl - twine upload artifact-${{ matrix.arch_type }}-${{ matrix.python-version }}/*.whl - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index cc5232e..cd94e0a 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -18,17 +18,11 @@ on: paths: - '.github/workflows/cd.yml' jobs: - wheel-linux: - uses: ./.github/workflows/build-wheel-linux.yml - secrets: inherit - wheel-macos: - uses: ./.github/workflows/build-wheel-macos.yml - secrets: inherit wheel-windows: uses: ./.github/workflows/build-wheel-windows.yml secrets: inherit pypi: - needs: [wheel-linux, wheel-macos, wheel-windows] + needs: [wheel-windows] uses: ecmwf/reusable-workflows/.github/workflows/cd-pypi.yml@v2 secrets: inherit diff --git a/README.rst b/README.rst index a2e7c4c..d34c66f 100644 --- a/README.rst +++ b/README.rst @@ -24,8 +24,11 @@ Limitations: Installation ============ -**From version 2.37.0, the ecCodes Python bindings on PyPi additionally provide the ecCodes binary library, and will -follow the version numbering of the ecCodes binary library. See below for details.** +**From version 2.43.0, the ecCodes Python bindings on PyPi will depend +on the PyPi package 'eccodeslib' on Linux and MacOS. This package provides +the binary ecCodes library. On Windows, the ecCodes Python bindings will +continue to directly provide the ecCodes binary library without a dependency +on eccodeslib. See below for details.** Installation from PyPI ---------------------- @@ -34,17 +37,38 @@ The package can be installed from PyPI with:: $ pip install eccodes -This installation will, by default, include the ecCodes binary library (as of version 2.37.0), meaning that no -external ecCodes binary library is required. If you have an external ecCodes binary library that you wish to use, -set the following environment variable before you import eccodes:: +This installation will, by default, include the ecCodes binary library (either +supplied by the 'eccodes' package on Windows, or via the 'eccodeslib' package +on Linux and MacOS), meaning that no external ecCodes binary library is +required. + + +Bypassing the provided binary library +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Linux and MacOS ++++++++++++++++ + +If you have an external ecCodes binary library that you wish to use, consult the documentation +of the `findlibs `_ package, which is used by the ecCodes Python bindings to +locate the binary library. This allows the use of environment variables +to refine the search algorithm. + + +Windows ++++++++ + +If you have an external ecCodes binary library that you wish to use, set the +following environment variable before you import eccodes:: $ export ECCODES_PYTHON_USE_FINDLIBS=1 If this is set, the ecCodes' Python bindings will use the `findlibs `_ package -to locate the binary library (findlibs was the only mechanism used before version 2.37.0). - -You may also install a version of ecCodes' Python interface that does not include a binary library at all, -in which case the findlibs mechanism will be used as before:: +to locate the binary library. + +You may also install a version of ecCodes' Python interface that does not +include a binary library at all, in which case the findlibs mechanism will +be used as before:: $ pip install eccodes --no-binary eccodes @@ -58,15 +82,18 @@ ecCodes' Python bindings can be installed from the `conda-forge &1 > tmp - cat tmp - v=$(grep 'already installed' < tmp | awk '{print $2;}' | sed 's/\\d://') - echo "yum $p $v" >> versions -done - - -sudo yum install -y flex bison - -sudo ln -sf /opt/python/cp310-cp310/bin/python /usr/local/bin/python3 -sudo ln -sf /opt/python/cp310-cp310/bin/python3-config /usr/local/bin/python3-config -sudo ln -sf /opt/python/cp310-cp310/bin/pip /usr/local/bin/pip3 - -sudo pip3 install ninja auditwheel meson 'setuptools>=72.1.0' - -sudo ln -sf /opt/python/cp310-cp310/bin/meson /usr/local/bin/meson -sudo ln -sf /opt/python/cp310-cp310/bin/ninja /usr/local/bin/ninja - -PKG_CONFIG_PATH=/usr/lib64/pkgconfig:/usr/lib/pkgconfig:$PKG_CONFIG_PATH -PKG_CONFIG_PATH=$TOPDIR/install/lib/pkgconfig:$TOPDIR/install/lib64/pkgconfig:$PKG_CONFIG_PATH -LD_LIBRARY_PATH=$TOPDIR/install/lib:$TOPDIR/install/lib64:$LD_LIBRARY_PATH - -# Build openjpeg -# - because the one supplied with 'yum' is built with fast-math, which interferes with Python - -[[ -d src/openjpeg ]] || git clone --branch $OPENJPEG_VERSION --depth=1 $GIT_OPENJPEG src/openjpeg - -mkdir -p $TOPDIR/build-binaries/openjpeg -cd $TOPDIR/build-binaries/openjpeg - -cmake \ - $TOPDIR/src/openjpeg/ \ - -DCMAKE_BUILD_TYPE=RelWithDebInfo \ - -DCMAKE_INSTALL_PREFIX=$TOPDIR/install - -cd $TOPDIR -cmake --build build-binaries/openjpeg --target install - -# Build eccodes - -cd $TOPDIR/build-binaries/eccodes - -$TOPDIR/src/ecbuild/bin/ecbuild \ - $TOPDIR/src/eccodes \ - -GNinja \ - -DCMAKE_BUILD_TYPE=RelWithDebInfo \ - -DENABLE_PYTHON=0 \ - -DENABLE_BUILD_TOOLS=0 \ - -DENABLE_ECCODES_THREADS=1 \ - -DENABLE_JPG=1 \ - -DENABLE_JPG_LIBJASPER=0 \ - -DENABLE_JPG_LIBOPENJPEG=1 \ - -DOPENJPEG_DIR=$TOPDIR/install \ - -DENABLE_MEMFS=1 \ - -DENABLE_INSTALL_ECCODES_DEFINITIONS=0 \ - -DENABLE_INSTALL_ECCODES_SAMPLES=0 \ - -DCMAKE_INSTALL_PREFIX=$TOPDIR/install $ECCODES_COMMON_CMAKE_OPTIONS - -cd $TOPDIR -cmake --build build-binaries/eccodes --target install - - - -# Create wheel - -mkdir -p install/lib/ -cp install/lib64/*.so install/lib/ -strip --strip-debug install/lib/*.so - -./scripts/versions.sh > eccodes/versions.txt diff --git a/scripts/build-macos.sh b/scripts/build-macos.sh deleted file mode 100755 index ada361b..0000000 --- a/scripts/build-macos.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/env bash -# (C) Copyright 2024- ECMWF. -# -# This software is licensed under the terms of the Apache Licence Version 2.0 -# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# In applying this licence, ECMWF does not waive the privileges and immunities -# granted to it by virtue of its status as an intergovernmental organisation -# nor does it submit to any jurisdiction. - -set -eaux -python_version=$1 - -uname -a - -# HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 -HOMEBREW_NO_INSTALL_CLEANUP=1 - -arch=$(arch) -[[ $arch == "i386" ]] && arch="x86_64" # GitHub Actions on macOS declare i386 - -ARCH="arch -$arch" - -source scripts/common.sh -source scripts/select-python-macos.sh $python_version - - -#$ARCH brew install cmake ninja pkg-config automake -#$ARCH brew install cmake ninja netcdf libaec - - -for p in netcdf -do - v=$(brew info $p | grep Cellar | awk '{print $1;}' | awk -F/ '{print $NF;}') - echo "brew $p $v" >> versions -done - -# Build eccodes - -cd $TOPDIR/build-binaries/eccodes - -# We disable JASPER because of a linking issue. JPEG support comes from -# other libraries (e.g. openjpeg) -$ARCH $TOPDIR/src/ecbuild/bin/ecbuild \ - $TOPDIR/src/eccodes \ - -GNinja \ - -DCMAKE_OSX_ARCHITECTURES=$arch \ - -DCMAKE_BUILD_TYPE=RelWithDebInfo \ - -DENABLE_FORTRAN=0 \ - -DENABLE_BUILD_TOOLS=0 \ - -DENABLE_ECCODES_THREADS=1 \ - -DENABLE_JPG_LIBJASPER=0 \ - -DENABLE_MEMFS=1 \ - -DENABLE_INSTALL_ECCODES_DEFINITIONS=0 \ - -DENABLE_INSTALL_ECCODES_SAMPLES=0 \ - -DCMAKE_INSTALL_PREFIX=$TOPDIR/install \ - -DCMAKE_INSTALL_RPATH=$TOPDIR/install/lib $ECCODES_COMMON_CMAKE_OPTIONS - -cd $TOPDIR -$ARCH cmake --build build-binaries/eccodes --target install - -# Run some basic tests to check the library is ok -cd build-binaries/eccodes -ctest -L sanity -cd $TOPDIR - -# Create wheel -rm -fr dist wheelhouse - - -# echo "================================================================================" -# for n in install/lib/*.dylib -# do -# echo $n -# ./scripts/libs-macos.py $n -# done -# echo "================================================================================" - -strip -S install/lib/*.dylib - -./scripts/versions.sh > gribapi/binary-versions.txt diff --git a/scripts/select-python-linux.sh b/scripts/select-python-linux.sh deleted file mode 100755 index 5c98812..0000000 --- a/scripts/select-python-linux.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash -# (C) Copyright 2024- ECMWF. -# -# This software is licensed under the terms of the Apache Licence Version 2.0 -# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# In applying this licence, ECMWF does not waive the privileges and immunities -# granted to it by virtue of its status as an intergovernmental organisation -# nor does it submit to any jurisdiction. - -set -xe -version=$1 - -source /opt/conda/etc/profile.d/conda.sh - -CONDA_PY_ENV_DIR=$RUNNER_TEMP/venv_$version - -if [ ! -d "${CONDA_PY_ENV_DIR}" ]; then - conda create -y -p $CONDA_PY_ENV_DIR -fi - -conda activate $CONDA_PY_ENV_DIR -conda install -y python=$version openldap - -which python3 -python3 --version diff --git a/scripts/select-python-macos.sh b/scripts/select-python-macos.sh deleted file mode 100755 index f837546..0000000 --- a/scripts/select-python-macos.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash -# (C) Copyright 2024- ECMWF. -# -# This software is licensed under the terms of the Apache Licence Version 2.0 -# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# In applying this licence, ECMWF does not waive the privileges and immunities -# granted to it by virtue of its status as an intergovernmental organisation -# nor does it submit to any jurisdiction. - -set -xe -version=$1 - -P_PATH=$(brew --prefix --installed python@$version)/libexec/bin -PATH=$P_PATH:$PATH - -# temporarily do not fail on unbound env vars so that this script can work outside GitHub Actions -set +u -if [ ! -z "${GITHUB_ACTION}" ]; then - echo $P_PATH >> $GITHUB_PATH -fi -set -u - -echo Python version $1 at $P_PATH diff --git a/scripts/test-linux.sh b/scripts/test-linux.sh deleted file mode 100755 index 15ab111..0000000 --- a/scripts/test-linux.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env bash -# (C) Copyright 2024- ECMWF. -# -# This software is licensed under the terms of the Apache Licence Version 2.0 -# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# In applying this licence, ECMWF does not waive the privileges and immunities -# granted to it by virtue of its status as an intergovernmental organisation -# nor does it submit to any jurisdiction. - -set -eaux -python_version=$1 - -ls -l -source ./scripts/select-python-linux.sh ${python_version} - -echo $PATH -pwd -ls -l - -pip install *.whl -pip install pytest -pip install -r tests/requirements.txt -pip freeze - -ls -l $RUNNER_TEMP/venv_$version/lib/python${python_version}/site-packages/eccodes.libs/ - -cd tests -ECCODES_PYTHON_TRACE_LIB_SEARCH=1 pytest -v -s - -rm -fr *.whl tests \ No newline at end of file diff --git a/scripts/test-macos.sh b/scripts/test-macos.sh deleted file mode 100755 index 59af06f..0000000 --- a/scripts/test-macos.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env bash -# (C) Copyright 2024- ECMWF. -# -# This software is licensed under the terms of the Apache Licence Version 2.0 -# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# In applying this licence, ECMWF does not waive the privileges and immunities -# granted to it by virtue of its status as an intergovernmental organisation -# nor does it submit to any jurisdiction. - -set -eaux -python_version=$1 - -VENV_DIR=./dist_venv_${python_version} - -ls -l -source ./scripts/select-python-macos.sh ${python_version} -echo $PATH - -rm -rf ${VENV_DIR} -which python -python --version -python -m venv ${VENV_DIR} -source ${VENV_DIR}/bin/activate -echo $PATH -which python -python --version - -pwd -ls -l - -pip install *.whl -pip install pytest -pip install -r tests/requirements.txt -pip freeze - -cd tests -ECCODES_PYTHON_TRACE_LIB_SEARCH=1 pytest -v -s - -rm -fr *.whl tests \ No newline at end of file diff --git a/scripts/wheel-linux.sh b/scripts/wheel-linux.sh deleted file mode 100755 index 09160d5..0000000 --- a/scripts/wheel-linux.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env bash -# (C) Copyright 2024- ECMWF. -# -# This software is licensed under the terms of the Apache Licence Version 2.0 -# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# In applying this licence, ECMWF does not waive the privileges and immunities -# granted to it by virtue of its status as an intergovernmental organisation -# nor does it submit to any jurisdiction. - -set -eaux - -# ensure the cleanup task can delete our workspace -umask 0000 -chmod -R a+w . - -version=$(echo $1| sed 's/\.//') - -TOPDIR=$(/bin/pwd) - -LD_LIBRARY_PATH=$TOPDIR/install/lib:$TOPDIR/install/lib64:$LD_LIBRARY_PATH - -sudo /opt/python/cp${version}-cp${version}/bin/pip3 install 'setuptools>=72.1.0' -/opt/python/cp${version}-cp${version}/bin/pip3 list - -rm -fr dist wheelhouse -/opt/python/cp${version}-cp${version}/bin/python3 setup.py --binary-wheel bdist_wheel - -# Do it twice to get the list of libraries - -auditwheel repair dist/*.whl -unzip -l wheelhouse/*.whl -unzip -l wheelhouse/*.whl | grep 'eccodes.libs/' > libs - -pip3 install -r scripts/requirements.txt -python3 ./scripts/copy-licences.py libs - -rm -fr dist wheelhouse -/opt/python/cp${version}-cp${version}/bin/python3 setup.py --binary-wheel bdist_wheel -auditwheel repair dist/*.whl -rm -fr dist diff --git a/scripts/wheel-macos.sh b/scripts/wheel-macos.sh deleted file mode 100755 index a36baf6..0000000 --- a/scripts/wheel-macos.sh +++ /dev/null @@ -1,101 +0,0 @@ -#!/usr/bin/env bash -# (C) Copyright 2024- ECMWF. -# -# This software is licensed under the terms of the Apache Licence Version 2.0 -# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# In applying this licence, ECMWF does not waive the privileges and immunities -# granted to it by virtue of its status as an intergovernmental organisation -# nor does it submit to any jurisdiction. - -set -eaux -python_version=$1 - -arch=$(arch) -[[ $arch == "i386" ]] && arch="x86_64" # GitHub Actions on macOS declare i386 - -ARCH="arch -$arch" - -diet() { - - if [[ $arch == "x86_64" ]]; then - return - fi - - # Remove the architectures we don't need - - echo ================================================================= - pwd - cd dist - pwd - name=$(ls -1 *.whl) - echo $name - unzip *.whl - ls -l - cd eccodes - ls -l - so=$(ls -1 *.so) - echo "$so" - - lipo -info $so - lipo -thin $arch $so -output $so.$arch - mv $so.$arch $so - lipo -info $so - cd .. - pwd - zip -r $name eccodes - cd .. - - echo ================================================================= - pwd - - ls -l dist -} - -# version=$(echo $1| sed 's/\.//') -env | sort - -source scripts/select-python-macos.sh $python_version - - -pip3 list -brew list - -# set up virtualenv -$ARCH python -m venv ./dist_venv_${python_version} -source ./dist_venv_${python_version}/bin/activate - -pip list -brew list - -pip3 install wheel delocate setuptools pytest - -rm -fr dist wheelhouse tmp -$ARCH python setup.py --binary-wheel bdist_wheel - -#IR diet - -name=$(ls -1 dist/*.whl) -newname=$(echo $name | sed "s/_universal2/_${arch}/") -echo $name $newname - -# Do it twice to get the list of libraries -$ARCH delocate-wheel -w wheelhouse dist/*.whl -unzip -l wheelhouse/*.whl | grep 'dylib' >libs -pip3 install -r scripts/requirements.txt -python ./scripts/copy-licences.py libs - -DISTUTILS_DEBUG=1 - -rm -fr dist wheelhouse -$ARCH python setup.py --binary-wheel bdist_wheel # --plat-name $arch -#IR diet - -# mv dist/$name $newname -# find dist/*.dist-info -print - -$ARCH delocate-wheel -w wheelhouse dist/*.whl - -# test the wheel -pip install --force-reinstall wheelhouse/*.whl -cd tests -pytest \ No newline at end of file diff --git a/setup.py b/setup.py index 41b0b87..a4b7609 100644 --- a/setup.py +++ b/setup.py @@ -86,7 +86,7 @@ def shared(directory): elif sys.version_info < (3, 9): install_requires = ["numpy<1.25"] -install_requires += ["attrs", "cffi", "findlibs"] +install_requires += ["attrs", "cffi", "findlibs", "eccodeslib;platform_system!='Windows'"] setuptools.setup( name="eccodes", From 86b4bfbe36aca2e4f8703d84a4a18acd0776fae5 Mon Sep 17 00:00:00 2001 From: Iain Russell Date: Tue, 8 Jul 2025 17:29:27 +0100 Subject: [PATCH 2/2] ECC-2106: depend on eccodeslib --- setup.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index a4b7609..105dd3e 100644 --- a/setup.py +++ b/setup.py @@ -86,7 +86,12 @@ def shared(directory): elif sys.version_info < (3, 9): install_requires = ["numpy<1.25"] -install_requires += ["attrs", "cffi", "findlibs", "eccodeslib;platform_system!='Windows'"] +install_requires += [ + "attrs", + "cffi", + "findlibs", + "eccodeslib;platform_system!='Windows'", +] setuptools.setup( name="eccodes",