[dev-python/imaging] port from tree, add proper python-tk dependency

This commit is contained in:
Fabio Erculiani
2013-08-06 16:02:04 +02:00
parent a94c080e7d
commit d74dc6069f
7 changed files with 174 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
DIST Imaging-1.1.7.tar.gz 498749 SHA256 895bc7c2498c8e1f9b99938f1a40dc86b3f149741f105cf7c7bd2e0725405211 SHA512 fec2d39b4db3cb33cd7e7895aba4c3a8a5d4cff28decb9106c88e392cb848edf5593fcd77d11994bb16321837fdb26958787dac2c86d6f7c09996f466bac11f1 WHIRLPOOL e610b4097723f77de4c495537c64741ee4bd996f89d12e2e7853fb8f09028d02fa46920a86827f263eb6324a9063d2321ff865c80b7f8482b19f8143500575e8
@@ -0,0 +1,14 @@
--- Imaging-1.1.6.orig/PIL/GifImagePlugin.py 2006-12-03 11:37:15.000000000 +0000
+++ Imaging-1.1.6/PIL/GifImagePlugin.py 2008-10-02 14:51:43.000000000 +0100
@@ -352,6 +352,11 @@
for i in range(maxcolor):
s.append(chr(i) * 3)
+ if im.info.has_key('transparency'):
+ transparentIndex = im.info['transparency']
+ s.append('!' + chr(0xf9) + chr(4) + chr(1) + chr(0) + chr(0) +
+ chr(transparentIndex) + chr(0))
+
return s
def getdata(im, offset = (0, 0), **params):
@@ -0,0 +1,20 @@
--- setup.py.old 2009-07-03 11:34:59.141671252 +0200
+++ setup.py 2009-07-03 11:51:54.415666711 +0200
@@ -281,6 +281,8 @@ class pil_build_ext(build_ext):
if struct.unpack("h", "\0\1")[0] == 1:
defs.append(("WORDS_BIGENDIAN", None))
+ libs.append("m")
+
exts = [(Extension(
"_imaging", files, libraries=libs, define_macros=defs
))]
@@ -332,7 +334,7 @@ class pil_build_ext(build_ext):
))
if os.path.isfile("_imagingmath.c"):
- exts.append(Extension("_imagingmath", ["_imagingmath.c"]))
+ exts.append(Extension("_imagingmath", ["_imagingmath.c"], libraries=["m"]))
self.extensions[:] = exts
@@ -0,0 +1,18 @@
--- PIL/ImageShow.py.old 2009-11-30 10:28:37.000000000 +0100
+++ PIL/ImageShow.py 2009-11-30 10:29:02.000000000 +0100
@@ -149,13 +149,10 @@
def get_command_ex(self, file, title=None, **options):
# note: xv is pretty outdated. most modern systems have
# imagemagick's display command instead.
- command = executable = "xv"
- if title:
- # FIXME: do full escaping
- command = command + " -name \"%s\"" % title
+ command = executable = "xdg-open"
return command, executable
- if which("xv"):
+ if which("xdg-open"):
register(XVViewer)
if __name__ == "__main__":
@@ -0,0 +1,13 @@
--- Imaging-1.1.6/Sane/_sane.c.orig 2006-12-03 13:12:22.000000000 +0100
+++ Imaging-1.1.6/Sane/_sane.c 2009-02-28 11:41:19.000000000 +0200
@@ -1152,8 +1152,8 @@
static PyObject *
PySane_get_devices(PyObject *self, PyObject *args)
{
- SANE_Device **devlist;
- SANE_Device *dev;
+ const SANE_Device **devlist;
+ const SANE_Device *dev;
SANE_Status st;
PyObject *list;
int local_only, i;
+103
View File
@@ -0,0 +1,103 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI=5
PYTHON_COMPAT=( python{2_5,2_6,2_7} )
inherit distutils-r1
MY_P=Imaging-${PV}
DESCRIPTION="Python Imaging Library (PIL)"
HOMEPAGE="http://www.pythonware.com/products/pil/index.htm"
SRC_URI="http://www.effbot.org/downloads/${MY_P}.tar.gz"
LICENSE="HPND"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x86-solaris"
IUSE="doc examples jpeg lcms scanner test tiff tk truetype zlib"
RDEPEND="
truetype? ( media-libs/freetype:2 )
jpeg? ( virtual/jpeg )
lcms? ( media-libs/lcms:0 )
scanner? ( media-gfx/sane-backends )
tiff? ( media-libs/tiff )
zlib? ( sys-libs/zlib )
tk? ( || ( dev-lang/python-tk:2.7 dev-lang/python-tk:2.6 dev-lang/python-tk:2.5 ) )
!dev-python/pillow"
DEPEND="${RDEPEND}"
RDEPEND+=" !dev-python/pillow"
# Tests don't handle missing jpeg, tiff & zlib properly.
REQUIRED_USE="test? ( jpeg tiff zlib )"
S="${WORKDIR}/${MY_P}"
python_prepare_all() {
local PATCHES=(
"${FILESDIR}/${P}-no-xv.patch"
"${FILESDIR}/${P}-sane.patch"
"${FILESDIR}/${P}-giftrans.patch"
"${FILESDIR}/${P}-missing-math.patch"
)
# Add shebangs.
sed -e "1i#!/usr/bin/env python" -i Scripts/*.py || die
# Disable all the stuff we don't want.
local f
for f in jpeg lcms tiff tk zlib; do
if ! use ${f}; then
sed -i -e "s:feature.${f} =:& None #:" setup.py || die
fi
done
if ! use truetype; then
sed -i -e 's:feature.freetype =:& None #:' setup.py || die
fi
distutils-r1_python_prepare_all
}
# XXX: split into two ebuilds?
wrap_phase() {
"${@}"
if use scanner; then
cd Sane || die
"${@}"
fi
}
python_compile() {
wrap_phase distutils-r1_python_compile
}
python_test() {
"${PYTHON}" selftest.py || die "Tests fail with ${EPYTHON}"
}
python_install() {
python_doheader libImaging/{Imaging.h,ImPlatform.h}
wrap_phase distutils-r1_python_install
}
python_install_all() {
use doc && local HTML_DOCS=( Docs/. )
use examples && local EXAMPLES=( Scripts/. )
distutils-r1_python_install_all
if use scanner; then
docinto sane
dodoc Sane/{CHANGES,README,sanedoc.txt}
fi
if use examples && use scanner; then
docinto examples/sane
dodoc Sane/demo_*.py
docompress -x /usr/share/${PF}/examples
fi
}
+5
View File
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<herd>python</herd>
</pkgmetadata>