Skip to content

Commit 4aa3135

Browse files
authored
Merge pull request OSGeo#12180 from rouault/pyproject_license_deprecation_warning
Python bindings: avoid deprecation warning with setuptools >= 77
2 parents d9b7a5f + 6ff110c commit 4aa3135

File tree

2 files changed

+54
-1
lines changed

2 files changed

+54
-1
lines changed

swig/python/CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,16 @@ if (Python_Interpreter_FOUND)
180180
endif ()
181181

182182
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/README.rst ${CMAKE_CURRENT_BINARY_DIR}/README.rst @ONLY)
183-
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/pyproject.toml ${CMAKE_CURRENT_BINARY_DIR}/pyproject.toml @ONLY)
183+
184+
execute_process(
185+
COMMAND ${Python_EXECUTABLE} -c "import setuptools; print(setuptools.__version__)"
186+
OUTPUT_VARIABLE SETUPTOOLS_VERSION
187+
OUTPUT_STRIP_TRAILING_WHITESPACE)
188+
if (SETUPTOOLS_VERSION VERSION_GREATER_EQUAL 77.0.3)
189+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/pyproject.toml.setuptools_gte_77 ${CMAKE_CURRENT_BINARY_DIR}/pyproject.toml @ONLY)
190+
else()
191+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/pyproject.toml ${CMAKE_CURRENT_BINARY_DIR}/pyproject.toml @ONLY)
192+
endif()
184193

185194
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/get_suffix.py
186195
"from importlib.machinery import EXTENSION_SUFFIXES; print(EXTENSION_SUFFIXES[0])\n")
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
[build-system]
2+
requires = ["setuptools>=77.0.3",
3+
"wheel",
4+
"oldest-supported-numpy; python_version=='3.8'",
5+
"numpy >=2.0.0rc1; python_version>='3.9'"]
6+
build-backend = "setuptools.build_meta"
7+
8+
[project]
9+
name = "GDAL"
10+
dynamic = ["version", "scripts"]
11+
authors = [
12+
{name = "Frank Warmerdam"},
13+
{name = "Howard Butler"},
14+
{name = "Even Rouault"},
15+
]
16+
maintainers = [
17+
{name = "GDAL contributors", email = "[email protected]"},
18+
]
19+
description = "GDAL: Geospatial Data Abstraction Library"
20+
readme = "README.rst"
21+
keywords = ["gis", "raster", "vector"]
22+
license = "MIT"
23+
classifiers = [
24+
"Development Status :: 5 - Production/Stable",
25+
"Intended Audience :: Developers",
26+
"Intended Audience :: Science/Research",
27+
"Operating System :: OS Independent",
28+
"Programming Language :: Python :: 3",
29+
"Programming Language :: C",
30+
"Programming Language :: C++",
31+
"Topic :: Scientific/Engineering :: GIS",
32+
"Topic :: Scientific/Engineering :: Information Analysis",
33+
]
34+
requires-python = ">=3.8"
35+
36+
[project.optional-dependencies]
37+
numpy = ['numpy>1.0.0']
38+
39+
[project.urls]
40+
Homepage = "https://gdal.org"
41+
Documentation = "https://gdal.org"
42+
Repository = "https://github.com/OSGeo/GDAL.git"
43+
Changelog = "https://github.com/OSGeo/gdal/blob/master/NEWS.md"
44+
Issues = "https://github.com/OSGeo/gdal/issues"

0 commit comments

Comments
 (0)