Use https by default
[gentoo.git] / sci-chemistry / pymol / pymol-1.7.4.0.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6
7 PYTHON_COMPAT=( python2_7 )
8 PYTHON_REQ_USE="tk"
9
10 inherit distutils-r1 fdo-mime versionator
11
12 DESCRIPTION="A Python-extensible molecular graphics system"
13 HOMEPAGE="http://www.pymol.org/"
14 SRC_URI="
15         https://dev.gentoo.org/~jlec/distfiles/${PN}-1.7.0.0.png.xz
16         https://dev.gentoo.org/~jlec/distfiles/${P}.tar.xz
17 "
18 #       mirror://sourceforge/project/${PN}/${PN}/$(get_version_component_range 1-2)/${PN}-v${PV}.tar.bz2
19 # git archive -v --prefix=${P}/ master -o ${P}.tar.xz
20
21 LICENSE="PSF-2.2"
22 SLOT="0"
23 KEYWORDS="~amd64 ~ppc ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x86-macos"
24 IUSE="apbs web"
25
26 DEPEND="
27         dev-python/numpy[${PYTHON_USEDEP}]
28         dev-python/pyopengl[${PYTHON_USEDEP}]
29         media-libs/freeglut
30         media-libs/freetype:2
31         media-libs/glew
32         media-libs/libpng:0=
33         media-video/mpeg-tools
34         sys-libs/zlib
35         virtual/pmw[${PYTHON_USEDEP}]
36         apbs? (
37                 sci-chemistry/apbs[${PYTHON_USEDEP}]
38                 sci-chemistry/pdb2pqr[${PYTHON_USEDEP}]
39                 sci-chemistry/pymol-apbs-plugin[${PYTHON_USEDEP}]
40         )
41         web? ( !dev-python/webpy[${PYTHON_USEDEP}] )"
42 RDEPEND="${DEPEND}"
43
44 S="${WORKDIR}"/${P}/${PN}
45
46 PATCHES=(
47         "${FILESDIR}"/${PN}-1.7.3.1-maeffplugin.cpp.patch
48         )
49
50 python_prepare_all() {
51         sed \
52                 -e "s:\"/usr:\"${EPREFIX}/usr:g" \
53                 -e "/ext_comp_args.*+=/s:\[.*\]$:\[\]:g" \
54                 -e "/import/s:argparse:argparseX:g" \
55                 -i setup.py || die
56
57         rm ./modules/pmg_tk/startup/apbs_tools.py || die
58
59         sed \
60                 -e "s:/opt/local:${EPREFIX}/usr:g" \
61                 -e '/ext_comp_args/s:\[.*\]:[]:g' \
62                 -i setup.py || die
63
64         distutils-r1_python_prepare_all
65 }
66
67 python_install() {
68         distutils-r1_python_install --pymol-path="${EPREFIX}/usr/share/pymol"
69 }
70
71 python_install_all() {
72         distutils-r1_python_install_all
73
74         python_export python2_7 EPYTHON
75
76         # These environment variables should not go in the wrapper script, or else
77         # it will be impossible to use the PyMOL libraries from Python.
78         cat >> "${T}"/20pymol <<- EOF
79                 PYMOL_PATH="$(python_get_sitedir)/${PN}"
80                 PYMOL_DATA="${EPREFIX}/usr/share/pymol/data"
81                 PYMOL_SCRIPTS="${EPREFIX}/usr/share/pymol/scripts"
82         EOF
83
84         doenvd "${T}"/20pymol
85
86         newicon "${WORKDIR}"/${PN}-1.7.0.0.png ${PN}.png
87         make_desktop_entry ${PN} PyMol ${PN} \
88                 "Graphics;Education;Science;Chemistry;" \
89                 "MimeType=chemical/x-pdb;chemical/x-mdl-molfile;chemical/x-mol2;chemical/seq-aa-fasta;chemical/seq-na-fasta;chemical/x-xyz;chemical/x-mdl-sdf;"
90
91         if ! use web; then
92                 rm -rf "${D}/$(python_get_sitedir)/web" || die
93         fi
94
95         rm -f "${ED}"/usr/share/${PN}/LICENSE || die
96 }
97
98 pkg_postinst() {
99         fdo-mime_desktop_database_update
100         fdo-mime_mime_database_update
101 }
102
103 pkg_postrm() {
104         fdo-mime_desktop_database_update
105         fdo-mime_mime_database_update
106 }