/[gentoo-x86]/dev-python/matplotlib/matplotlib-1.0.1.ebuild
Gentoo

Contents of /dev-python/matplotlib/matplotlib-1.0.1.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (show annotations) (download)
Thu Apr 14 21:07:59 2011 UTC (3 years, 5 months ago) by arfrever
Branch: MAIN
CVS Tags: HEAD
Changes since 1.4: +1 -1 lines
FILE REMOVED
Delete older ebuilds.

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

  ViewVC Help
Powered by ViewVC 1.1.20