Date: Monday, June 15, 2020 @ 21:53:19 Author: kkeen Revision: 645571
python-pillow 7.0.0 drops py2, and breaks API Added: python-pillow6/ python-pillow6/repos/ python-pillow6/trunk/ python-pillow6/trunk/PKGBUILD ----------+ PKGBUILD | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) Added: python-pillow6/trunk/PKGBUILD =================================================================== --- python-pillow6/trunk/PKGBUILD (rev 0) +++ python-pillow6/trunk/PKGBUILD 2020-06-15 21:53:19 UTC (rev 645571) @@ -0,0 +1,93 @@ +# Maintainer: Kyle Keen <keen...@gmail.com> +# Contributor: minder + +pkgbase=python-pillow6 +pkgname=(python-pillow6 python2-pillow6) +pkgver=6.2.1 +pkgrel=1 +_appname=Pillow +_py2basever=2.7 +_py3basever=3.8 +pkgdesc="Python Imaging Library (PIL) fork. Python3 version." +arch=('x86_64') +url="https://python-pillow.github.io/" +license=('BSD') +depends=('lcms2' 'libtiff' 'openjpeg2' 'libimagequant') +optdepends=('freetype2: for the ImageFont module' + 'libraqm: for complex text scripts' + 'libwebp: for webp images' + 'tk: for the ImageTK module') +makedepends=('python-setuptools' 'python2-setuptools' 'freetype2' 'libraqm' 'libwebp' 'tk') +checkdepends=('python-pytest' 'python2-pytest') +source=("https://files.pythonhosted.org/packages/source/P/$_appname/$_appname-$pkgver.tar.gz") +md5sums=('13acde283ece6ac69f62609fa108d316') + +prepare() { + cp -r "$_appname-$pkgver" "$srcdir/python2-pillow" + + cd "$srcdir/$_appname-$pkgver" + rm -rf src/PIL6 + mv src/PIL src/PIL6 + sed -i 's|/PIL/|/PIL6/|' setup.py Makefile + sed -i 's|"PIL\.|"PIL6.|' setup.py src/_imagingcms.c src/PIL6/Image.py + sed -i 's|"PIL"|"PIL6"|' setup.py + sed -i 's|from PIL import|from PIL6 import|' selftest.py + sed -i 's|import PIL$|import PIL6|' src/PIL6/*.py docs/conf.py Tests/test_000_sanity.py + sed -i 's|PIL\.|PIL6.|' docs/conf.py + sed -i 's|from PIL import|from PIL6 import|' src/PIL6/*.py Tests/*.py + sed -i 's|from PIL\.|from PIL6.|' src/PIL6/*.py Tests/*.py + sed -i 's|PIL\.Image|PIL6.Image|' Tests/*.py + sed -i 's|"PIL"|"PIL6"|' Tests/test_main.py + sed -i 's|/PIL/|/PIL6/|' Tests/import_all.py + sed -i 's|100x100 at"|100x100 a"|' Tests/test_image.py + sed -i 's|100x100 "|100x100"|' Tests/test_image.py +} + +build() { + cd "$srcdir/$_appname-$pkgver" + python setup.py build + cd "$srcdir/python2-pillow" + python2 setup.py build +} + +check() { + cd "$srcdir/$_appname-$pkgver" + export PYTHONPATH="$PWD/build/lib.linux-$CARCH-${_py3basever%m}" + python selftest.py + # 99.6% of tests pass, just some font rendering giving trouble? + #pytest + + cd "$srcdir/python2-pillow" + export PYTHONPATH="$PWD/build/lib.linux-$CARCH-$_py2basever" + python2 selftest.py + # 99.6% of tests pass, just some font rendering giving trouble? + #pytest2 +} + +package_python-pillow6() { + depends+=('python') + optdepends+=('python-olefile: OLE2 file support' + 'python-pyqt5: for the ImageQt module') + cd "$srcdir/$_appname-$pkgver" + python3 setup.py install --root="$pkgdir/" --optimize=1 + install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE" + + # no easy way to support multiple versions of this + #install -dm755 "$pkgdir/usr/include/python$_py3basever/" + #install -m644 -t "$pkgdir/usr/include/python$_py3basever/" src/libImaging/*.h +} + +package_python2-pillow6() { + pkgdesc="Python Imaging Library (PIL) fork. Python2 version." + depends+=('python2') + optdepends+=('python2-olefile: OLE2 file support' + 'python2-pyqt5: for the ImageQt module') + provides=('python-imaging' 'python2-imaging' 'python2-pillow') + conflicts=('python-imaging' 'python2-imaging' 'python2-pillow') + cd "$srcdir/python2-pillow" + python2 setup.py install --root="$pkgdir/" --optimize=1 + install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE" + + install -dm755 "$pkgdir/usr/include/python$_py2basever/" + install -m644 -t "$pkgdir/usr/include/python$_py2basever/" src/libImaging/*.h +}