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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

1 # Copyright 1999-2010 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.0.ebuild,v 1.7 2010/10/30 23:24:16 arfrever 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.*"
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 dev-python/sphinx
39 media-gfx/graphviz[cairo]
40 || ( ( dev-texlive/texlive-latexextra
41 dev-texlive/texlive-fontsrecommended
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 excel? ( dev-python/xlwt ) )"
48
49 RDEPEND="${CDEPEND}
50 virtual/ttf-fonts
51 media-fonts/texcm-ttf
52 dev-python/pyparsing
53 cairo? ( dev-python/pycairo )
54 excel? ( dev-python/xlwt )
55 fltk? ( dev-python/pyfltk )
56 qt4? ( dev-python/PyQt4[X] )
57 traits? ( dev-python/traits dev-python/configobj )
58 latex? (
59 virtual/latex-base
60 app-text/ghostscript-gpl
61 app-text/dvipng
62 app-text/poppler[utils]
63 || ( dev-texlive/texlive-fontsrecommended
64 app-text/ptex ) )"
65
66 PYTHON_CFLAGS=("2.* + -fno-strict-aliasing")
67 PYTHON_CXXFLAGS=("2.* + -fno-strict-aliasing")
68
69 DOCS="INTERACTIVE"
70 PYTHON_MODNAME="matplotlib mpl_toolkits pylab.py"
71
72 use_setup() {
73 local uword="${2}"
74 [ -z "${2}" ] && uword="${1}"
75 if use ${1}; then
76 echo "${uword} = True"
77 echo "${uword}agg = True"
78 else
79 echo "${uword} = False"
80 echo "${uword}agg = False"
81 fi
82 }
83
84 src_prepare() {
85 # create setup.cfg (see setup.cfg.template for any changes)
86 cat > setup.cfg <<-EOF
87 [provide_packages]
88 pytz = False
89 dateutil = False
90 configobj = False
91 enthought.traits = False
92 [gui_support]
93 $(use_setup gtk)
94 $(use_setup tk)
95 $(use_setup wxwidgets wx)
96 $(use_setup qt4)
97 $(use_setup fltk)
98 $(use_setup cairo)
99 EOF
100
101 # avoid checks needing a X display
102 sed -i \
103 -e "s/check_for_gtk()/$(use gtk && echo True || echo False)/" \
104 -e "s/check_for_tk()/$(use tk && echo True || echo False)/" \
105 setup.py || die "sed setup.py failed"
106
107 # respect FHS:
108 # - mpl-data in /usr/share/matplotlib
109 # - config files in /etc/matplotlib
110 sed -i \
111 -e "/'mpl-data\/matplotlibrc',/d" \
112 -e "/'mpl-data\/matplotlib.conf',/d" \
113 -e "s:'lib/matplotlib/mpl-data/matplotlibrc':'matplotlibrc':" \
114 -e "s:'lib/matplotlib/mpl-data/matplotlib.conf':'matplotlib.conf':" \
115 setup.py \
116 || die "sed setup.py for FHS failed"
117
118 # remove internal copies of fonts, pycxx, pyparsing
119 rm -rf \
120 CXX \
121 lib/matplotlib/mpl-data/fonts/{afm,pdfcorefonts} \
122 lib/matplotlib/mpl-data/fonts/ttf/{Vera*,cm*,*.TXT} \
123 lib/matplotlib/pyparsing.py \
124 || die "removed internal copies failed"
125
126 sed -i \
127 -e 's/matplotlib.pyparsing/pyparsing/g' \
128 lib/matplotlib/{mathtext,fontconfig_pattern}.py \
129 || die "sed pyparsing failed"
130 }
131
132 src_compile() {
133 unset DISPLAY # bug #278524
134 distutils_src_compile_pre_hook() {
135 ln -fs "${EPREFIX}/usr/share/python$(python_get_version)/CXX" .
136 }
137 distutils_src_compile
138
139 if use doc; then
140 cd "${S}/doc"
141 export VARTEXFONTS="${T}"/fonts
142 MATPLOTLIBDATA="${S}/lib/matplotlib/mpl-data" \
143 PYTHONPATH=$(ls -d "${S}"/build-$(PYTHON -f --ABI)/lib*) \
144 "$(PYTHON -f)" make.py --small all
145 [[ -e build/latex/Matplotlib.pdf ]] || die "doc generation failed"
146 fi
147 }
148
149 src_test() {
150 # if doc were enabled, all examples were built and tested
151 use doc && return
152 einfo "Tests are quite long, be patient"
153 cd "${S}/examples/tests"
154 testing() {
155 PYTHONPATH=$(ls -d "${S}"/build-${PYTHON_ABI}/lib*) "$(PYTHON)" backend_driver.py agg || return 1
156 PYTHONPATH=$(ls -d "${S}"/build-${PYTHON_ABI}/lib*) "$(PYTHON)" backend_driver.py --clean
157 }
158 python_execute_function testing
159 }
160
161 src_install() {
162 # sed only after doc building, to allow using default configs
163 sed -i \
164 -e "s:path = get_data_path():path = '${EPREFIX}/etc/matplotlib':" \
165 -e "s:os.path.dirname(__file__):'${EPREFIX}/usr/share/${PN}':g" \
166 build-*/lib*/matplotlib/__init__.py \
167 || die "sed init for FHS failed"
168 distutils_src_install
169
170 # Respect FHS
171 dodir /usr/share/${PN}
172 mv "${ED}$(python_get_sitedir -f)/${PN}/"{mpl-data,backends/Matplotlib.nib} "${ED}usr/share/${PN}" || die "Renaming failed"
173 rm -fr "${ED}"usr/lib*/python*/site-packages/${PN}/{mpl-data,backends/Matplotlib.nib}
174
175 insinto /etc/matplotlib
176 doins matplotlibrc matplotlib.conf || die "installing config files failed"
177
178 # doc and examples
179 insinto /usr/share/doc/${PF}
180 if use doc; then
181 doins doc/build/latex/Matplotlib.pdf || die
182 doins -r doc/build/html || die
183 fi
184 if use examples; then
185 doins -r examples || die
186 fi
187 }

  ViewVC Help
Powered by ViewVC 1.1.20