description="Python HTTP for Humans"
url="https://pypi.python.org/pypi/requests"
packager="spiky <spiky@nutyx.org>"
contributors="Hugo,Tnut"

makedepends=(python-urllib3 python-chardet python-certifi python-idna)

name=python-requests
_name="requests"
alias=(${_name})

version=2.32.3

PKGMK_KEEP_SOURCES="no"
source=(https://files.pythonhosted.org/packages/source/r/requests/requests-$version.tar.gz
        certs.patch)

prepare() {
  cd ${_name}-$version

  # Stay with chardet for now: https://github.com/psf/requests/issues/5871

  sed \
    -e '/certifi/d' \
    -e "s/,<.*'/'/" \
    -e '/charset_normalizer/d' \
    -i setup.py

  patch -p1 -d src -i $SRC/certs.patch
}

build(){

 cd ${_name}-$version

  pip3 wheel -w dist \
    --no-build-isolation \
    --no-deps $PWD
  pip3 install --no-index \
    --find-links dist \
    --no-cache-dir    \
    --no-user         \
    --root=$PKG       \
    ${_name}

 find $PKG -type d -name vendor -o -name tests |xargs rm -rf 
}
