Use https by default
[gentoo.git] / sci-chemistry / pymol / pymol-1.7.6.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 flag-o-matic 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 python_prepare_all() {
47         sed \
48                 -e "s:\"/usr:\"${EPREFIX}/usr:g" \
49                 -e "/ext_comp_args.*+=/s:\[.*\]$:\[\]:g" \
50                 -e "/import/s:argparse:argparseX:g" \
51                 -i setup.py || die
52
53         sed \
54                 -e "s:/opt/local:${EPREFIX}/usr:g" \
55                 -e '/ext_comp_args/s:\[.*\]:[]:g' \
56                 -i setup.py || die
57
58         append-cxxflags -std=c++0x
59
60         distutils-r1_python_prepare_all
61 }
62
63 python_install() {
64         distutils-r1_python_install --pymol-path="${EPREFIX}/usr/share/pymol"
65
66         sed \
67                 -e '1d' \
68                 -e "/APBS_BINARY_LOCATION/s:None:\"${EPREFIX}/usr/bin/apbs\":g" \
69                 -e "/APBS_PSIZE_LOCATION/s:None:\"$(python_get_sitedir)/pdb2pqr/src/\":g" \
70                 -e "/APBS_PDB2PQR_LOCATION/s:None:\"$(python_get_sitedir)/pdb2pqr/\":g" \
71                 -i "${D}/$(python_get_sitedir)"/pmg_tk/startup/apbs_tools.py || die
72 }
73
74 python_install_all() {
75         distutils-r1_python_install_all
76
77         sed \
78                 -e '1i#!/usr/bin/env python' \
79                 "${D}/$(python_get_sitedir)"/pymol/__init__.py > "${T}"/${PN} || die
80
81         python_foreach_impl python_doscript "${T}"/${PN}
82
83         # These environment variables should not go in the wrapper script, or else
84         # it will be impossible to use the PyMOL libraries from Python.
85         cat >> "${T}"/20pymol <<- EOF
86                 PYMOL_PATH="${EPREFIX}/usr/share/pymol"
87                 PYMOL_DATA="${EPREFIX}/usr/share/pymol/data"
88                 PYMOL_SCRIPTS="${EPREFIX}/usr/share/pymol/scripts"
89         EOF
90
91         doenvd "${T}"/20pymol
92
93         newicon "${WORKDIR}"/${PN}-1.7.0.0.png ${PN}.png
94         make_desktop_entry ${PN} PyMol ${PN} \
95                 "Graphics;Education;Science;Chemistry;" \
96                 "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;"
97
98         if ! use web; then
99                 rm -rf "${D}/$(python_get_sitedir)/web" || die
100         fi
101
102         rm -f "${ED}"/usr/share/${PN}/LICENSE || die
103 }
104
105 pkg_postinst() {
106         fdo-mime_desktop_database_update
107         fdo-mime_mime_database_update
108 }
109
110 pkg_postrm() {
111         fdo-mime_desktop_database_update
112         fdo-mime_mime_database_update
113 }