8fadc5ca34ac410e4e6da84ba61dd68be2adaf17
[gentoo.git] / dev-python / sympy / sympy-1.5.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 PYTHON_COMPAT=( python{2_7,3_6,3_7} )
7
8 inherit distutils-r1 eutils virtualx
9
10 DESCRIPTION="Computer Algebra System in pure Python"
11 HOMEPAGE="https://sympy.org"
12 SRC_URI="https://github.com/${PN}/${PN}/releases/download/${P}/${P}.tar.gz"
13
14 LICENSE="BSD"
15 SLOT="0"
16 KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
17 IUSE="doc examples gtk imaging ipython latex mathml opengl pdf png pyglet symengine test texmacs theano"
18
19 REQUIRED_USE="${PYTHON_REQUIRED_USE}
20         doc? ( || ( $(python_gen_useflags 'python2*') ) )
21         ipython? ( || ( $(python_gen_useflags -3) ) )"
22
23 RESTRICT="test"
24 # All tests actually pass, except a bunch of tests related to the deprecated pygletplot
25 # It is a non-trivial work to wipe out all such tests :-(
26
27 RDEPEND="dev-python/mpmath[${PYTHON_USEDEP}]
28         dev-python/pexpect[${PYTHON_USEDEP}]
29         imaging? ( dev-python/pillow[${PYTHON_USEDEP}] )
30         ipython? ( $(python_gen_cond_dep 'dev-python/ipython[${PYTHON_USEDEP}]' -3) )
31         latex? (
32                 virtual/latex-base
33                 dev-texlive/texlive-fontsextra
34                 png? ( app-text/dvipng )
35                 pdf? ( app-text/ghostscript-gpl )
36         )
37         mathml? (
38                 dev-libs/libxml2:2[${PYTHON_USEDEP}]
39                 $(python_gen_cond_dep 'dev-libs/libxslt[${PYTHON_USEDEP}]' python2_7)
40                 gtk? ( x11-libs/gtkmathview[gtk] )
41         )
42         opengl? ( dev-python/pyopengl[${PYTHON_USEDEP}] )
43         pyglet? ( dev-python/pyglet[${PYTHON_USEDEP}] )
44         symengine? ( dev-python/symengine[${PYTHON_USEDEP}] )
45         texmacs? ( app-office/texmacs )
46         theano? ( dev-python/theano[${PYTHON_USEDEP}] )
47 "
48
49 DEPEND="${RDEPEND}
50         doc? ( dev-python/sphinx[${PYTHON_USEDEP}] app-text/docbook2X )
51         test? ( ${RDEPEND} dev-python/pytest[${PYTHON_USEDEP}] )"
52
53 pkg_setup() {
54         use doc && DISTUTILS_ALL_SUBPHASE_IMPLS=( 'python2*' )
55 }
56
57 python_compile_all() {
58         if use doc; then
59                 export XDG_CONFIG_HOME="${T}/config-dir"
60                 mkdir "${XDG_CONFIG_HOME}" || die
61                 chmod 0700 "${XDG_CONFIG_HOME}" || die
62                 emake -j1 -C doc html info man cheatsheet
63         fi
64 }
65
66 python_test() {
67         virtx "${PYTHON}" setup.py test
68 }
69
70 python_install_all() {
71         local DOCS=( AUTHORS README.rst )
72         if use doc; then
73                 DOCS+=( doc/_build/cheatsheet/cheatsheet.pdf \
74                                 doc/_build/cheatsheet/combinatoric_cheatsheet.pdf )
75                 local HTML_DOCS=( doc/_build/html/. )
76                 doinfo doc/_build/texinfo/${PN}.info
77         fi
78         if use examples; then
79                 dodoc -r examples
80                 docompress -x /usr/share/doc/${PF}/examples
81         fi
82         distutils-r1_python_install_all
83
84         if use texmacs; then
85                 exeinto /usr/libexec/TeXmacs/bin/
86                 doexe data/TeXmacs/bin/tm_sympy
87                 insinto /usr/share/TeXmacs/plugins/sympy/
88                 doins -r data/TeXmacs/progs
89         fi
90 }