| 1 |
# Copyright 1999-2012 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: /var/cvsroot/gentoo-x86/dev-python/imaging/imaging-1.1.7-r1.ebuild,v 1.11 2012/05/28 14:14:07 armin76 Exp $
|
| 4 |
|
| 5 |
EAPI="3"
|
| 6 |
PYTHON_DEPEND="2"
|
| 7 |
PYTHON_USE_WITH="tk"
|
| 8 |
PYTHON_USE_WITH_OPT="tk"
|
| 9 |
SUPPORT_PYTHON_ABIS="1"
|
| 10 |
RESTRICT_PYTHON_ABIS="3.* *-jython 2.7-pypy-*"
|
| 11 |
|
| 12 |
inherit eutils multilib distutils
|
| 13 |
|
| 14 |
MY_P=Imaging-${PV}
|
| 15 |
|
| 16 |
DESCRIPTION="Python Imaging Library (PIL)"
|
| 17 |
HOMEPAGE="http://www.pythonware.com/products/pil/index.htm"
|
| 18 |
SRC_URI="http://www.effbot.org/downloads/${MY_P}.tar.gz"
|
| 19 |
|
| 20 |
LICENSE="HPND"
|
| 21 |
SLOT="0"
|
| 22 |
KEYWORDS="alpha amd64 arm hppa ia64 ppc ppc64 sparc x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x86-solaris"
|
| 23 |
IUSE="doc examples lcms scanner tk X"
|
| 24 |
|
| 25 |
DEPEND="virtual/jpeg
|
| 26 |
media-libs/freetype:2
|
| 27 |
lcms? ( media-libs/lcms:0 )
|
| 28 |
scanner? ( media-gfx/sane-backends )
|
| 29 |
X? ( x11-misc/xdg-utils )"
|
| 30 |
RDEPEND="${DEPEND}"
|
| 31 |
|
| 32 |
S="${WORKDIR}/${MY_P}"
|
| 33 |
|
| 34 |
DOCS="CHANGES CONTENTS"
|
| 35 |
|
| 36 |
pkg_setup() {
|
| 37 |
PYTHON_MODNAME="PIL $(use scanner && echo sane.py)"
|
| 38 |
python_pkg_setup
|
| 39 |
}
|
| 40 |
|
| 41 |
src_prepare() {
|
| 42 |
distutils_src_prepare
|
| 43 |
|
| 44 |
epatch "${FILESDIR}/${P}-no-xv.patch"
|
| 45 |
epatch "${FILESDIR}/${P}-sane.patch"
|
| 46 |
epatch "${FILESDIR}/${P}-giftrans.patch"
|
| 47 |
epatch "${FILESDIR}/${P}-missing-math.patch"
|
| 48 |
if ! use lcms; then
|
| 49 |
epatch "${FILESDIR}/${P}-nolcms.patch"
|
| 50 |
fi
|
| 51 |
|
| 52 |
# Add shebang.
|
| 53 |
sed -e "1i#!/usr/bin/python" -i Scripts/pilfont.py \
|
| 54 |
|| die "sed failed adding shebang"
|
| 55 |
|
| 56 |
sed -i \
|
| 57 |
-e "s:/usr/lib\":/usr/$(get_libdir)\":" \
|
| 58 |
-e "s:\"lib\":\"$(get_libdir)\":g" \
|
| 59 |
setup.py || die "sed failed"
|
| 60 |
|
| 61 |
if ! use tk; then
|
| 62 |
# Make the test always fail
|
| 63 |
sed -i \
|
| 64 |
-e 's/import _tkinter/raise ImportError/' \
|
| 65 |
setup.py || die "sed failed"
|
| 66 |
fi
|
| 67 |
}
|
| 68 |
|
| 69 |
src_compile() {
|
| 70 |
distutils_src_compile
|
| 71 |
|
| 72 |
if use scanner; then
|
| 73 |
pushd Sane > /dev/null
|
| 74 |
distutils_src_compile
|
| 75 |
popd > /dev/null
|
| 76 |
fi
|
| 77 |
}
|
| 78 |
|
| 79 |
src_test() {
|
| 80 |
tests() {
|
| 81 |
PYTHONPATH="$(ls -d build-${PYTHON_ABI}/lib.*)" "$(PYTHON)" selftest.py
|
| 82 |
}
|
| 83 |
python_execute_function tests
|
| 84 |
}
|
| 85 |
|
| 86 |
src_install() {
|
| 87 |
distutils_src_install
|
| 88 |
|
| 89 |
if use doc; then
|
| 90 |
dohtml Docs/* || die "dohtml failed"
|
| 91 |
fi
|
| 92 |
|
| 93 |
if use scanner; then
|
| 94 |
pushd Sane > /dev/null
|
| 95 |
docinto sane
|
| 96 |
DOCS="CHANGES sanedoc.txt" distutils_src_install
|
| 97 |
popd > /dev/null
|
| 98 |
fi
|
| 99 |
|
| 100 |
# Install headers required by media-gfx/sketch.
|
| 101 |
install_headers() {
|
| 102 |
insinto "$(python_get_includedir)"
|
| 103 |
doins libImaging/Imaging.h
|
| 104 |
doins libImaging/ImPlatform.h
|
| 105 |
}
|
| 106 |
python_execute_function install_headers
|
| 107 |
|
| 108 |
if use examples; then
|
| 109 |
insinto /usr/share/doc/${PF}/examples
|
| 110 |
doins Scripts/* || die "doins failed"
|
| 111 |
|
| 112 |
if use scanner; then
|
| 113 |
insinto /usr/share/doc/${PF}/examples/sane
|
| 114 |
doins Sane/demo_*.py || die "doins failed"
|
| 115 |
fi
|
| 116 |
fi
|
| 117 |
}
|