git » python-pillow.git » main » tree

[main] / PKGBUILD

# Maintainer: George Rawlinson <grawlinson@archlinux.org>
# Contributor: Kyle Keen <keenerd@gmail.com>
# Contributor: minder

pkgname=python-pillow
pkgver=10.3.0
pkgrel=2
pkgdesc='Python Imaging Library (PIL) fork'
arch=('x86_64' 'armv7h')
url='https://python-pillow.org'
license=('BSD')
depends=(
  'glibc'
  'python'
  'python-packaging'
  'freetype2'
  'lcms2'
  'libraqm'
  'libtiff'
  'openjpeg2'
  'libjpeg-turbo'
  'libimagequant'
  'libxcb'
  'zlib'
)
makedepends=(
  'git'
  'python-build'
  'python-installer'
  'python-wheel'
  'python-setuptools'
  'libwebp'
  'tk'
)
#checkdepends=(
#  'python-pytest'
#  'python-pytest-timeout'
#)
optdepends=(
  'libwebp: for webp images'
  'tk: for the ImageTK module'
  'python-olefile: OLE2 file support'
  'python-pyqt6: for the ImageQt module'
)
_commit='5c89d88eee199ba53f64581ea39b6a1bc52feb1a'
source=("$pkgname::git+https://github.com/python-pillow/Pillow#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd "$pkgname"

  git describe --tags | sed 's/^v//'
}

build() {
  cd "$pkgname"
  sed -i 's/"setuptools>=67.8",//' pyproject.toml
  python -m build --wheel --no-isolation
}

check() {
  return 0
  cd "$pkgname"

  local python_version=$(python -c 'import sys; print("".join(map(str, sys.version_info[:2])))')
  export PYTHONPATH="$PWD/build/lib.linux-$CARCH-cpython-$python_version"
  python selftest.py
  pytest -v
}

package() {
  cd "$pkgname"

  python -m installer --destdir="$pkgdir" dist/*.whl

  local python_version=$(python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
  install -vDm644 -t "$pkgdir/usr/include/python$python_version" src/libImaging/*.h

  # symlink license file
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  install -d "$pkgdir/usr/share/licenses/$pkgname"
  ln -s "$site_packages/Pillow-$pkgver.dist-info/LICENSE" \
    "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}