Merge pull request #10138 from lazka/add-python-rtree

Add python-rtree
This commit is contained in:
Christoph Reiter
2021-11-20 14:18:14 +01:00
committed by GitHub
2 changed files with 65 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
--- rtree-0.9.7/rtree/finder.py.orig 2021-11-20 12:23:16.300000000 +0100
+++ rtree-0.9.7/rtree/finder.py 2021-11-20 12:23:42.113496900 +0100
@@ -8,6 +8,7 @@
import sys
import ctypes
import platform
+import sysconfig
from ctypes.util import find_library
# the current working directory of this file
@@ -33,6 +34,13 @@
Loaded shared library
"""
if os.name == 'nt':
+ if sysconfig.get_platform().startswith("mingw"):
+ lib_name = 'libspatialindex_c'
+ path = find_library(lib_name)
+ if path is None:
+ raise OSError("could not find or load {}".format(lib_name))
+ return ctypes.cdll.LoadLibrary(path)
+
# check the platform architecture
if '64' in platform.architecture()[0]:
arch = '64'

View File

@@ -0,0 +1,41 @@
_realname=rtree
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=0.9.7
pkgrel=1
pkgdesc="Rtree: spatial index for Python GIS (mingw-w64)"
arch=('any')
url='https://github.com/Toblerity/rtree'
license=('LGPL')
depends=("${MINGW_PACKAGE_PREFIX}-python"
"${MINGW_PACKAGE_PREFIX}-spatialindex")
makedepends=("${MINGW_PACKAGE_PREFIX}-python"
"${MINGW_PACKAGE_PREFIX}-python-wheel"
"${MINGW_PACKAGE_PREFIX}-python-setuptools")
source=("${_realname}-${pkgver}.tar.gz::https://github.com/Toblerity/rtree/archive/refs/tags/${pkgver}.tar.gz"
"0001-fix-mingw-finder.patch")
sha256sums=('920a3dc3654ee7060b6d99daa2dc51f28a2878333a2ade7916040652df9fa65a'
'3a51bacc22c95e062f26924b3461c4aa892e1873737cb0973288aaf60529cc64')
prepare() {
cd "${srcdir}/${_realname}-${pkgver}"
patch -Np1 -i "${srcdir}"/0001-fix-mingw-finder.patch
cd -
cp -r "${_realname}-${pkgver}" "python-build-${CARCH}"
}
build() {
cd "${srcdir}/python-build-${CARCH}"
${MINGW_PREFIX}/bin/python setup.py build
}
package() {
cd "${srcdir}/python-build-${CARCH}"
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
${MINGW_PREFIX}/bin/python setup.py install --prefix=${MINGW_PREFIX} \
--root="${pkgdir}" --optimize=1 --skip-build
install -Dm644 LICENSE.txt "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE.txt"
}