-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Python bindings: add a pyproject.toml with numpy as a build requireme…
…nt (#8926) Fixes #8069. Hopefully a compromise that will satisfy most needs... - add a pyproject.toml with numpy as a build requirement - make absence of numpy at build time an error by default, unless the GDAL_PYTHON_BINDINGS_WITHOUT_NUMPY env var is set. - despite numpy being a build requirement, numpy remains an optional dependency at install time if users just install with "pip install gdal" (for folks that would do vector only operations with GDAL) - for people needing numpy support, they have to use "pip install gdal[numpy]". * swig/python/CMakeLists.txt: check return value of execute_process() at various places
- Loading branch information
Showing
9 changed files
with
129 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
ci/travis/conda/0001-Fix-build-of-Python-bindings-due-to-https-github.com.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
[build-system] | ||
requires = ["setuptools>=61.0.0", "oldest-supported-numpy", "wheel"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "GDAL" | ||
dynamic = ["version", "scripts"] | ||
authors = [ | ||
{name = "Frank Warmerdam"}, | ||
{name = "Howard Butler"}, | ||
{name = "Even Rouault"}, | ||
] | ||
maintainers = [ | ||
{name = "GDAL contributors", email = "gdal-dev@lists.osgeo.org"}, | ||
] | ||
description = "GDAL: Geospatial Data Abstraction Library" | ||
readme = "README.rst" | ||
keywords = ["gis", "raster", "vector"] | ||
license = {text = "MIT"} | ||
classifiers = [ | ||
"Development Status :: 5 - Production/Stable", | ||
"Intended Audience :: Developers", | ||
"Intended Audience :: Science/Research", | ||
"License :: OSI Approved :: MIT License", | ||
"Operating System :: OS Independent", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: C", | ||
"Programming Language :: C++", | ||
"Topic :: Scientific/Engineering :: GIS", | ||
"Topic :: Scientific/Engineering :: Information Analysis", | ||
] | ||
requires-python = ">=3.8" | ||
|
||
[project.optional-dependencies] | ||
numpy = ['numpy>1.0.0'] | ||
|
||
[project.urls] | ||
Homepage = "https://gdal.org" | ||
Documentation = "https://gdal.org" | ||
Repository = "https://github.com/OSGeo/GDAL.git" | ||
Changelog = "https://github.com/OSGeo/gdal/blob/master/NEWS.md" | ||
Issues = "https://github.com/OSGeo/gdal/issues" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters