1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python2_7 )
8 inherit distutils-r1 desktop eutils flag-o-matic xdg-utils
10 DESCRIPTION="A Python-extensible molecular graphics system"
11 HOMEPAGE="https://www.pymol.org/"
13 https://dev.gentoo.org/~jlec/distfiles/${PN}-1.8.4.0.png.xz
14 https://github.com/schrodinger/pymol-open-source/archive/v${PV}.tar.gz -> ${P}.tar.gz
19 KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x86-macos"
26 dev-python/numpy-python2[${PYTHON_USEDEP}]
27 dev-python/numpy[${PYTHON_USEDEP}]
29 dev-python/pmw:py2[${PYTHON_USEDEP}]
30 dev-python/pyopengl[${PYTHON_USEDEP}]
31 dev-python/PyQt5[opengl,${PYTHON_USEDEP}]
36 media-video/mpeg-tools
38 !sci-chemistry/pymol-apbs-plugin[${PYTHON_USEDEP}]
39 web? ( !dev-python/webpy[${PYTHON_USEDEP}] )"
41 sci-chemistry/chemical-mime-data
44 S="${WORKDIR}"/${PN}-open-source-${PV}
46 python_prepare_all() {
48 -e "s:\"/usr:\"${EPREFIX}/usr:g" \
49 -e "/ext_comp_args.*+=/s:\[.*\]$:\[\]:g" \
50 -e "/import/s:argparse:argparseX:g" \
54 -e "s:/opt/local:${EPREFIX}/usr:g" \
55 -e '/ext_comp_args/s:\[.*\]:[]:g' \
58 -e "s:\['msgpackc'\]:\['msgpack'\]:g" \
61 append-cxxflags -std=c++0x
63 distutils-r1_python_prepare_all
67 distutils-r1_python_install \
68 --pymol-path="${EPREFIX}/usr/share/pymol"
72 -e "/APBS_BINARY_LOCATION/s:None:\"${EPREFIX}/usr/bin/apbs\":g" \
73 -e "/APBS_PSIZE_LOCATION/s:None:\"$(python_get_sitedir)/pdb2pqr/src/\":g" \
74 -e "/APBS_PDB2PQR_LOCATION/s:None:\"$(python_get_sitedir)/pdb2pqr/\":g" \
75 -i "${D}/$(python_get_sitedir)"/pmg_tk/startup/apbs_tools.py || die
78 python_install_all() {
79 distutils-r1_python_install_all
82 -e '1i#!/usr/bin/env python' \
83 "${D}/$(python_get_sitedir)"/pymol/__init__.py > "${T}"/${PN} || die
85 python_foreach_impl python_doscript "${T}"/${PN}
87 # These environment variables should not go in the wrapper script, or else
88 # it will be impossible to use the PyMOL libraries from Python.
89 cat >> "${T}"/20pymol <<- EOF
90 PYMOL_PATH="${EPREFIX}/usr/share/pymol"
91 PYMOL_DATA="${EPREFIX}/usr/share/pymol/data"
92 PYMOL_SCRIPTS="${EPREFIX}/usr/share/pymol/scripts"
97 newicon "${WORKDIR}"/${PN}-1.8.4.0.png ${PN}.png
98 make_desktop_entry ${PN} PyMol ${PN} \
99 "Graphics;Education;Science;Chemistry;" \
100 "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;"
103 rm -rf "${D}/$(python_get_sitedir)/web" || die
106 rm -f "${ED}"/usr/share/${PN}/LICENSE || die
110 xdg_desktop_database_update
111 xdg_mimeinfo_database_update
112 optfeature "Electrostatic calculations" sci-chemistry/apbs sci-chemistry/pdb2pqr
116 xdg_desktop_database_update
117 xdg_mimeinfo_database_update