Skip to content

Commit

Permalink
Python bindings: add a pyproject.toml with numpy as a build dependency (
Browse files Browse the repository at this point in the history
fixes OSGeo#8069)
  • Loading branch information
rouault committed Dec 6, 2023
1 parent 9e9ff0a commit bc4e370
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
2 changes: 2 additions & 0 deletions swig/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ if (Python_Interpreter_FOUND)
endif ()

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/README.rst ${CMAKE_CURRENT_BINARY_DIR}/README.rst @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/pyproject.toml ${CMAKE_CURRENT_BINARY_DIR}/pyproject.toml @ONLY)

file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/get_suffix.py
"from importlib.machinery import EXTENSION_SUFFIXES; print(EXTENSION_SUFFIXES[0])\n")
Expand Down Expand Up @@ -300,6 +301,7 @@ if (Python_Interpreter_FOUND)
symlink_or_copy("${CMAKE_CURRENT_SOURCE_DIR}/gdal-utils" "${INSTALL_WORKING_DIRECTORY}/gdal-utils")
set(BUILD_EXT_WITH_RPATH_CONTENT)
string(APPEND BUILD_EXT_WITH_RPATH_CONTENT "configure_file(\"${CMAKE_CURRENT_SOURCE_DIR}/README.rst\" \"${INSTALL_WORKING_DIRECTORY}/README.rst\" @ONLY)\n")
string(APPEND BUILD_EXT_WITH_RPATH_CONTENT "configure_file(\"${CMAKE_CURRENT_SOURCE_DIR}/pyproject.toml\" \"${INSTALL_WORKING_DIRECTORY}/pyproject.toml\" @ONLY)\n")
string(APPEND BUILD_EXT_WITH_RPATH_CONTENT "file(COPY \"${CMAKE_CURRENT_BINARY_DIR}/extensions\" DESTINATION \"${INSTALL_WORKING_DIRECTORY}\")\n")
string(APPEND BUILD_EXT_WITH_RPATH_CONTENT "file(GLOB PY_FILES \"${CMAKE_CURRENT_BINARY_DIR}/osgeo/*.py\")\n")
string(APPEND BUILD_EXT_WITH_RPATH_CONTENT "foreach(_file IN LISTS PY_FILES)\n")
Expand Down
32 changes: 32 additions & 0 deletions swig/python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[build-system]
requires = ["setuptools", "oldest-supported-numpy"]
build-backend = "setuptools.build_meta"

[project]
name = "GDAL"
dynamic = ["readme", "version", "scripts", "optional-dependencies"]
authors = [
{name = "Frank Warmerdam"},
{name = "Howard Butler"},
{name = "Even Rouault"},
]
maintainers = [
{name = "GDAL contributors"},
]
description = "GDAL: Geospatial Data Abstraction Librarys"
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"

0 comments on commit bc4e370

Please sign in to comment.