1 |
arfrever |
1.1 |
# Copyright 1999-2010 Gentoo Foundation |
2 |
|
|
# Distributed under the terms of the GNU General Public License v2 |
3 |
bicatali |
1.9 |
# $Header: /var/cvsroot/gentoo-x86/dev-python/matplotlib/matplotlib-0.99.1.1-r1.ebuild,v 1.8 2010/05/30 16:32:31 phajdan.jr Exp $ |
4 |
arfrever |
1.1 |
|
5 |
|
|
EAPI="2" |
6 |
|
|
PYTHON_DEPEND="2" |
7 |
|
|
SUPPORT_PYTHON_ABIS="1" |
8 |
|
|
WX_GTK_VER="2.8" |
9 |
|
|
|
10 |
bicatali |
1.9 |
inherit eutils distutils wxwidgets flag-o-matic |
11 |
arfrever |
1.1 |
|
12 |
|
|
PDOC="users_guide_${PV}" |
13 |
|
|
|
14 |
|
|
DESCRIPTION="Pure python plotting library with matlab like syntax" |
15 |
|
|
HOMEPAGE="http://matplotlib.sourceforge.net/ http://pypi.python.org/pypi/matplotlib" |
16 |
|
|
SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz" |
17 |
|
|
|
18 |
|
|
IUSE="cairo doc excel examples fltk gtk latex qt4 traits tk wxwidgets" |
19 |
|
|
SLOT="0" |
20 |
phajdan.jr |
1.8 |
KEYWORDS="amd64 ppc x86 ~x86-freebsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos" |
21 |
arfrever |
1.1 |
LICENSE="PYTHON BSD" |
22 |
|
|
|
23 |
|
|
CDEPEND=">=dev-python/numpy-1.1 |
24 |
|
|
dev-python/python-dateutil |
25 |
|
|
dev-python/pytz |
26 |
|
|
media-libs/freetype:2 |
27 |
|
|
media-libs/libpng |
28 |
|
|
gtk? ( dev-python/pygtk ) |
29 |
|
|
tk? ( dev-lang/python[tk] ) |
30 |
|
|
wxwidgets? ( dev-python/wxpython:2.8 )" |
31 |
|
|
|
32 |
|
|
DEPEND="${CDEPEND} |
33 |
|
|
dev-python/pycxx |
34 |
|
|
dev-util/pkgconfig |
35 |
|
|
doc? ( |
36 |
|
|
>=dev-python/sphinx-0.5.1 |
37 |
|
|
|| ( |
38 |
|
|
>=media-gfx/graphviz-2.24.0[cairo] |
39 |
|
|
<media-gfx/graphviz-2.24.0[cairo,png] |
40 |
|
|
) |
41 |
|
|
|| ( ( dev-texlive/texlive-latexextra |
42 |
|
|
dev-texlive/texlive-latexrecommended ) |
43 |
|
|
( app-text/ptex dev-tex/latex-unicode ) ) |
44 |
|
|
app-text/dvipng |
45 |
|
|
dev-python/imaging |
46 |
|
|
dev-python/ipython )" |
47 |
|
|
|
48 |
|
|
RDEPEND="${CDEPEND} |
49 |
spatz |
1.5 |
virtual/ttf-fonts |
50 |
arfrever |
1.1 |
media-fonts/texcm-ttf |
51 |
|
|
cairo? ( dev-python/pycairo ) |
52 |
|
|
excel? ( dev-python/xlwt ) |
53 |
|
|
fltk? ( dev-python/pyfltk ) |
54 |
|
|
qt4? ( dev-python/PyQt4[X] ) |
55 |
|
|
traits? ( dev-python/traits dev-python/configobj ) |
56 |
|
|
latex? ( |
57 |
|
|
virtual/latex-base |
58 |
|
|
app-text/ghostscript-gpl |
59 |
|
|
app-text/dvipng |
60 |
ssuominen |
1.3 |
>=app-text/poppler-0.12.3-r3[utils] |
61 |
arfrever |
1.1 |
|| ( dev-texlive/texlive-fontsrecommended |
62 |
|
|
app-text/ptex ) )" |
63 |
|
|
RESTRICT_PYTHON_ABIS="3.*" |
64 |
|
|
|
65 |
|
|
DOCS="INTERACTIVE" |
66 |
|
|
|
67 |
|
|
use_setup() { |
68 |
|
|
local uword="${2}" |
69 |
|
|
[ -z "${2}" ] && uword="${1}" |
70 |
|
|
if use ${1}; then |
71 |
|
|
echo "${uword} = True" |
72 |
|
|
echo "${uword}agg = True" |
73 |
|
|
else |
74 |
|
|
echo "${uword} = False" |
75 |
|
|
echo "${uword}agg = False" |
76 |
|
|
fi |
77 |
|
|
} |
78 |
|
|
|
79 |
|
|
src_prepare() { |
80 |
|
|
# avoid to launch xv while building examples docs |
81 |
|
|
epatch "${FILESDIR}"/${PN}-0.98.5.2-no-xv.patch |
82 |
|
|
|
83 |
|
|
# removes hardcoded lib paths, should not break non-Prefix, more |
84 |
|
|
# likely to fix it in case of multilib |
85 |
|
|
epatch "${FILESDIR}"/${P}-prefix.patch |
86 |
|
|
epatch "${FILESDIR}"/${PN}-0.99.0-freebsd7+.patch |
87 |
|
|
|
88 |
|
|
# create setup.cfg (see setup.cfg.template for any changes) |
89 |
|
|
cat > setup.cfg <<-EOF |
90 |
|
|
[provide_packages] |
91 |
|
|
pytz = False |
92 |
|
|
dateutil = False |
93 |
|
|
configobj = False |
94 |
|
|
enthought.traits = False |
95 |
|
|
[gui_support] |
96 |
|
|
$(use_setup gtk) |
97 |
|
|
$(use_setup tk) |
98 |
|
|
$(use_setup wxwidgets wx) |
99 |
|
|
$(use_setup qt4) |
100 |
|
|
$(use_setup fltk) |
101 |
|
|
$(use_setup cairo) |
102 |
|
|
EOF |
103 |
|
|
|
104 |
|
|
# avoid checks needing a X display |
105 |
|
|
sed -i \ |
106 |
|
|
-e "s/check_for_gtk()/$(use gtk && echo True || echo False)/" \ |
107 |
|
|
-e "s/check_for_tk()/$(use tk && echo True || echo False)/" \ |
108 |
|
|
setup.py || die "sed setup.py failed" |
109 |
|
|
|
110 |
|
|
# respect FHS: |
111 |
|
|
# - mpl-data in /usr/share/matplotlib |
112 |
|
|
# - config files in /etc/matplotlib |
113 |
|
|
sed -i \ |
114 |
|
|
-e "/'mpl-data\/matplotlibrc',/d" \ |
115 |
|
|
-e "/'mpl-data\/matplotlib.conf',/d" \ |
116 |
|
|
-e "s:'lib/matplotlib/mpl-data/matplotlibrc':'matplotlibrc':" \ |
117 |
|
|
-e "s:'lib/matplotlib/mpl-data/matplotlib.conf':'matplotlib.conf':" \ |
118 |
|
|
setup.py \ |
119 |
|
|
|| die "sed setup.py for FHS failed" |
120 |
|
|
|
121 |
|
|
sed -i \ |
122 |
|
|
-e "s:path = get_data_path():path = '${EPREFIX}/etc/matplotlib':" \ |
123 |
|
|
-e "s:os.path.dirname(__file__):'${EPREFIX}/usr/share/${PN}':g" \ |
124 |
|
|
lib/matplotlib/{__init__,config/cutils}.py \ |
125 |
|
|
|| die "sed init for FHS failed" |
126 |
|
|
|
127 |
|
|
# remove internal copies of fonts, pycxx, pyparsing |
128 |
|
|
rm -rf \ |
129 |
|
|
CXX \ |
130 |
|
|
lib/matplotlib/mpl-data/fonts/{afm,pdfcorefonts} \ |
131 |
|
|
lib/matplotlib/mpl-data/fonts/ttf/{Vera*,cm*,*.TXT} \ |
132 |
|
|
|| die "removed internal copies failed" |
133 |
|
|
|
134 |
|
|
# remove pyparsing only when upstream pyparsing included matplotlib |
135 |
|
|
# fixes. See bug #260025 |
136 |
|
|
#rm -f lib/matplotlib/pyparsing.py |
137 |
ssuominen |
1.4 |
|
138 |
|
|
epatch "${FILESDIR}"/${P}-libpng14.patch |
139 |
arfrever |
1.1 |
} |
140 |
|
|
|
141 |
|
|
src_compile() { |
142 |
|
|
unset DISPLAY # bug #278524 |
143 |
bicatali |
1.9 |
append-flags -DNDEBUG # bug #322347 |
144 |
arfrever |
1.1 |
distutils_src_compile_pre_hook() { |
145 |
|
|
ln -fs "${EPREFIX}/usr/share/python$(python_get_version)/CXX" . |
146 |
|
|
} |
147 |
|
|
distutils_src_compile |
148 |
|
|
|
149 |
|
|
if use doc; then |
150 |
|
|
cd "${S}/doc" |
151 |
|
|
export VARTEXFONTS="${T}"/fonts |
152 |
|
|
MATPLOTLIBDATA="${S}/lib/matplotlib/mpl-data" \ |
153 |
|
|
PYTHONPATH=$(ls -d "${S}"/build-$(PYTHON -f --ABI)/lib*) \ |
154 |
bicatali |
1.9 |
"$(PYTHON -f)" make.py all |
155 |
|
|
[[ -e build/latex/Matplotlib.pdf ]] || die "doc generation failed" |
156 |
arfrever |
1.1 |
fi |
157 |
|
|
} |
158 |
|
|
|
159 |
|
|
src_test() { |
160 |
|
|
einfo "Tests are quite long, be patient" |
161 |
|
|
cd "${S}/examples/tests" |
162 |
|
|
testing() { |
163 |
|
|
PYTHONPATH=$(ls -d "${S}"/build-${PYTHON_ABI}/lib*) "$(PYTHON)" backend_driver.py agg || return 1 |
164 |
|
|
PYTHONPATH=$(ls -d "${S}"/build-${PYTHON_ABI}/lib*) "$(PYTHON)" backend_driver.py --clean |
165 |
|
|
} |
166 |
|
|
python_execute_function testing |
167 |
|
|
} |
168 |
|
|
|
169 |
|
|
src_install() { |
170 |
|
|
[[ -z ${ED} ]] && local ED=${D} |
171 |
|
|
distutils_src_install |
172 |
|
|
|
173 |
|
|
# Respect FHS |
174 |
|
|
dodir /usr/share/${PN} |
175 |
|
|
mv "${ED}$(python_get_sitedir -f)/${PN}/"{mpl-data,backends/Matplotlib.nib} "${ED}usr/share/${PN}" || die "Renaming failed" |
176 |
|
|
rm -fr "${ED}"usr/lib*/python*/site-packages/${PN}/{mpl-data,backends/Matplotlib.nib} |
177 |
|
|
|
178 |
|
|
insinto /etc/matplotlib |
179 |
|
|
doins matplotlibrc matplotlib.conf || die "installing config files failed" |
180 |
|
|
|
181 |
|
|
# doc and examples |
182 |
|
|
insinto /usr/share/doc/${PF} |
183 |
|
|
if use doc; then |
184 |
|
|
doins doc/build/latex/Matplotlib.pdf || die |
185 |
|
|
doins -r doc/build/html || die |
186 |
|
|
fi |
187 |
|
|
if use examples; then |
188 |
|
|
doins -r examples || die |
189 |
|
|
fi |
190 |
|
|
} |