# Maintainer: Jaroslav Lichtblau <svetlemodry@archlinux.org>
# Maintainer: Bruno Pagani <archange@archlinux.org>
# Contributor: Stéphane Gaudreault <stephane@archlinux.org>

pkgname=python-pyproj
pkgver=3.6.1
pkgrel=2
pkgdesc="Python interfaces to PROJ.4 library"
arch=(x86_64 aarch64)
url="https://github.com/pyproj4/pyproj"
license=(custom)
depends=(proj python-certifi)
makedepends=(python-setuptools cython)
checkdepends=(python-pytest python-numpy python-pandas python-shapely python-xarray)
source=(https://github.com/pyproj4/pyproj/archive/$pkgver/$pkgname-$pkgver.tar.gz)
sha256sums=('33b4f865d370e37d290591b13985016e98fa9038a1a5bde5d0c208307ed5221d')

prepare() {
  # Remove RPATH
  sed -i 's/library_dirs if os.name.*/None/' pyproj-$pkgver/setup.py
}

build() {
  export PROJ_DIR=/usr
  cd pyproj-$pkgver
  python setup.py build
}

# Import issues, no time to investigate
#check() {
#  cd pyproj-$pkgver
#  local python_version=$(python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
#  PYTHONPATH="${PWD}"/build/lib.linux-$CARCH-${python_version} pytest -vv --color=yes
#}

package() {
  cd pyproj-$pkgver
  python setup.py install --prefix=/usr --root="${pkgdir}" --optimize=1 --skip-build
  install -Dm644 LICENSE_proj "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE
}
