1 # Copyright 1999-2024 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python3_{10..12} )
7 DISTUTILS_USE_PEP517="setuptools"
10 inherit desktop flag-o-matic xdg distutils-r1
12 DESCRIPTION="A Python-extensible molecular graphics system"
13 HOMEPAGE="https://www.pymol.org/"
14 SRC_URI="https://github.com/schrodinger/pymol-open-source/archive/v${PV}.tar.gz -> ${P}.tar.gz"
16 S="${WORKDIR}"/${PN}-open-source-${PV}
18 LICENSE="BitstreamVera BSD freedist HPND OFL-1.0 public-domain UoI-NCSA" #844991
20 KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux ~x64-macos"
26 dev-python/numpy[${PYTHON_USEDEP}]
32 netcdf? ( sci-libs/netcdf:0= )
34 BDEPEND="test? ( >=dev-cpp/catch-2:0 )"
37 media-video/mpeg-tools
38 dev-python/pyopengl[${PYTHON_USEDEP}]
39 dev-python/pyqt5[opengl,${PYTHON_USEDEP}]
40 dev-python/pmw[${PYTHON_USEDEP}]
41 sci-chemistry/chemical-mime-data
44 distutils_enable_tests pytest
46 # FIXME: We need to still figure out about how to make all the tests pass
47 # https://bugs.gentoo.org/932127
51 "${FILESDIR}/${P}-distutils-py3.12.patch"
52 "${FILESDIR}/${P}-SceneGetDrawFlag-indexing.patch"
53 "${FILESDIR}/${P}-eof-maeffplugin.patch"
54 "${FILESDIR}/${P}-numpy2.patch"
55 "${FILESDIR}/${P}-py3.12-progress.patch"
56 "${FILESDIR}/${P}-lto-molfile-plugin.patch"
59 python_prepare_all() {
61 -e "s:\"/usr:\"${EPREFIX}/usr:g" \
62 -e "/ext_comp_args.*+=/s:\[.*\]$:\[\]:g" \
66 -e "s:/opt/local:${EPREFIX}/usr:g" \
67 -e '/ext_comp_args/s:\[.*\]:[]:g' \
70 -e "s:\['msgpackc'\]:\['msgpack'\]:g" \
73 append-cxxflags -std=c++17
75 distutils-r1_python_prepare_all
78 python_configure_all() {
79 use !netcdf && DISTUTILS_ARGS=( --no-vmd-plugins )
83 distutils-r1_python_install \
84 --pymol-path="${EPREFIX}/usr/share/pymol"
87 -e '1i#!/usr/bin/env python' \
88 "${D}/$(python_get_sitedir)"/pymol/__init__.py > "${T}"/${PN} || die
89 python_doscript "${T}"/${PN}
93 "${EPYTHON}" -m pymol -ckqy testing/testing.py --offline --no-mmlibs --no-undo --run all || die
96 python_install_all() {
97 distutils-r1_python_install_all
99 # Move data to correct location
100 dodir /usr/share/pymol
101 mv "${D}/$(python_get_sitedir)"/pymol/pymol_path/* "${ED}/usr/share/pymol" || die
103 # These environment variables should not go in the wrapper script, or else
104 # it will be impossible to use the PyMOL libraries from Python.
105 cat >> "${T}"/20pymol <<- EOF || die
106 PYMOL_PATH="${EPREFIX}/usr/share/pymol"
107 PYMOL_DATA="${EPREFIX}/usr/share/pymol/data"
108 PYMOL_SCRIPTS="${EPREFIX}/usr/share/pymol/scripts"
111 doenvd "${T}"/20pymol
113 newicon "${S}"/data/pymol/icons/icon2.svg ${PN}.svg
114 make_desktop_entry "${PN} %u" PyMol ${PN} \
115 "Graphics;Education;Science;Chemistry;" \
116 "MimeType=chemical/x-pdb;chemical/pdby;chemical/x-mdl-sdfile;chemical/x-mdl-molfile;chemical/x-mol2;chemical/seq-aa-fasta;chemical/seq-na-fasta;chemical/x-xyz;chemical/x-mdl-sdf;chemical/x-macromodel-input;chemical/x-vmd;"
119 rm -rf "${D}/$(python_get_sitedir)/web" || die
122 rm -f "${ED}"/usr/share/${PN}/LICENSE || die