Skip to content

Commit

Permalink
ci/travis/conda: fix Python bindings build
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Dec 6, 2023
1 parent 99fe5a7 commit 442b785
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
From c8e8942b5dd50d1abb4369662b0cb9d282c3bf69 Mon Sep 17 00:00:00 2001
From: Even Rouault <even.rouault@spatialys.com>
Date: Wed, 6 Dec 2023 19:06:08 +0100
Subject: [PATCH] Fix build of Python bindings due to
https://github.com/OSGeo/gdal/pull/8926 changes

---
recipe/install_python.sh | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/recipe/install_python.sh b/recipe/install_python.sh
index 4bcd219..1561771 100644
--- a/recipe/install_python.sh
+++ b/recipe/install_python.sh
@@ -21,12 +21,14 @@ cmake "-UPython*" \
cmake --build . --target python_generated_files
cd swig/python

-cat >pyproject.toml <<EOF
-[build-system]
-requires = ["setuptools>=40.8.0", "wheel"]
-build-backend = "setuptools.build_meta"
-EOF
-
$PYTHON setup.py build_ext

+# Cf https://github.com/OSGeo/gdal/pull/8926
+# The above build_ext has been run with numpy already installed in the environment
+# because otherwise it would have failed.
+# But as we run pip install without dependencies, we have to force
+# GDAL_PYTHON_BINDINGS_WITHOUT_NUMPY=YES to disable the related check.
+# This is OK here since the bindings have already been built, and it is just
+# a matter of bundling them in the wheel.
+export GDAL_PYTHON_BINDINGS_WITHOUT_NUMPY=YES
$PYTHON -m pip install --no-deps --ignore-installed .
--
2.25.1

2 changes: 2 additions & 0 deletions ci/travis/conda/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ cd gdal-feedstock
patch -p1 < ../ci/travis/conda/build.sh.patch
patch -p1 --binary < ../ci/travis/conda/bld.bat.patch

patch -p1 < ../ci/travis/conda/0001-Fix-build-of-Python-bindings-due-to-https-github.com.patch

cat > recipe/recipe_clobber.yaml <<EOL
source:
path: ../../../gdal
Expand Down

0 comments on commit 442b785

Please sign in to comment.