dev-python/agate: Bump to 1.13.0
[gentoo/gentoo.git] / sci-chemistry / pymol / pymol-3.0.0-r1.ebuild
blobff2b8174eeb46065db30db4d10730c4bca0feb3a
1 # Copyright 1999-2024 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
4 EAPI=8
6 PYTHON_COMPAT=( python3_{10..12} )
7 DISTUTILS_USE_PEP517="setuptools"
8 DISTUTILS_EXT=1
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
19 SLOT="0"
20 KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux ~x64-macos"
21 IUSE="+netcdf web"
23 DEPEND="
24         dev-cpp/msgpack-cxx
25         dev-libs/mmtf-cpp
26         dev-python/numpy[${PYTHON_USEDEP}]
27         sys-libs/zlib
28         media-libs/freetype:2
29         media-libs/glew:0=
30         media-libs/glm
31         media-libs/libpng:0=
32         netcdf? ( sci-libs/netcdf:0= )
34 BDEPEND="test? ( >=dev-cpp/catch-2:0 )"
35 RDEPEND="
36         ${DEPEND}
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
48 RESTRICT="test"
50 PATCHES=(
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() {
60         sed \
61                 -e "s:\"/usr:\"${EPREFIX}/usr:g" \
62                 -e "/ext_comp_args.*+=/s:\[.*\]$:\[\]:g" \
63                 -i setup.py || die
65         sed \
66                 -e "s:/opt/local:${EPREFIX}/usr:g" \
67                 -e '/ext_comp_args/s:\[.*\]:[]:g' \
68                 -i setup.py || die
69         sed \
70                 -e "s:\['msgpackc'\]:\['msgpack'\]:g" \
71                 -i setup.py || die
73         append-cxxflags -std=c++17
75         distutils-r1_python_prepare_all
78 python_configure_all() {
79         use !netcdf && DISTUTILS_ARGS=( --no-vmd-plugins )
82 python_install() {
83         distutils-r1_python_install \
84                 --pymol-path="${EPREFIX}/usr/share/pymol"
86         sed \
87                 -e '1i#!/usr/bin/env python' \
88                 "${D}/$(python_get_sitedir)"/pymol/__init__.py > "${T}"/${PN} || die
89         python_doscript "${T}"/${PN}
92 python_test() {
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"
109         EOF
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;"
118         if ! use web; then
119                 rm -rf "${D}/$(python_get_sitedir)/web" || die
120         fi
122         rm -f "${ED}"/usr/share/${PN}/LICENSE || die