# Maintainer: FWS
# Dépendance de l'installateur Anaconda (rhinstaller) — adaptateur Requests
# pour les URL file:// (utilisé par le payload). Absent des dépôts Arch et de
# l'AUR. Module Python mono-fichier (pyproject : py-modules=["requests_file"]).
pkgname=python-requests-file
pkgver=2.1.0
pkgrel=1
pkgdesc="Transport adapter for using file:// URLs with python-requests (dépendance Anaconda)"
arch=('any')
url="https://github.com/dashea/requests-file"
license=('Apache-2.0')
depends=('python' 'python-requests')
source=("$pkgname-$pkgver.tar.gz::https://github.com/dashea/requests-file/archive/refs/tags/$pkgver.tar.gz")
sha256sums=('f5bf0a9d5a220b03ded522d0992b9c2778adaa084a8735710ad66f663fd91c6b')
_srcdir="requests-file-$pkgver"

package() {
  cd "$srcdir/$_srcdir"
  local sitedir
  sitedir=$(python -c 'import site; print(site.getsitepackages()[0])')
  # Module mono-fichier (pas de package dir) → on installe requests_file.py seul.
  install -Dm644 requests_file.py "$pkgdir$sitedir/requests_file.py"
  python -m compileall -q -d "$sitedir" "$pkgdir$sitedir/requests_file.py" || true
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
