# shellcheck shell=bash disable=SC2034,SC2154
# Packager: Storm Dragon <storm_dragon@stormux.org>

pkgname=python3-pillow
_srcname=pillow
pkgver=12.1.0
pkgrel=1slint
source=("https://files.pythonhosted.org/packages/d0/02/d52c733a2452ef1ffcc123b68e6606d07276b0e358db70eabad7e40042b7/pillow-12.1.0.tar.gz")
md5sums=("7be15203f5fe63d857814da49a51b616")
url="https://github.com/python-pillow/Pillow"
makedepends=('pybind11')
docs=("AUTHORS" "AUTHORS.txt" "CHANGELOG" "ChangeLog" "CHANGES" \
  "CHANGES.txt" "CHANGES.md" "COPYING" "COPYING.txt" "LICENSE" \
  "LICENSE.txt" "README" "README.md" "README.rst" "README.txt" "PKG-INFO")

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"python3-pillow (Python imaging library)"
""
"Pillow is the friendly PIL fork with image processing"
"capabilities."
""
"This package provides the Python 3 build of Pillow."
""
"Homepage: https://github.com/python-pillow/Pillow"
""
""
)

build() {
  cd "$SRC/${_srcname}-$pkgver" || exit 1

  PYTHONPATH="/usr/lib${LIBDIRSUFFIX}/python3.9/site-packages${PYTHONPATH:+:$PYTHONPATH}" \
    python3.11 -m pip install . \
      --root="$PKG" \
      --prefix=/usr \
      --no-deps \
      --no-build-isolation \
      --no-warn-script-location

  install -d "$PKG/usr/lib${LIBDIRSUFFIX}/python3.11/site-packages/PIL"
  find src/PIL -maxdepth 1 -type f \
    \( -name '*.py' -o -name '*.pyi' -o -name 'py.typed' \) \
    -exec install -m 644 {} \
      "$PKG/usr/lib${LIBDIRSUFFIX}/python3.11/site-packages/PIL" \;
}
