pymol-1.8.4.0-r1.ebuild 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. PYTHON_COMPAT=( python2_7 )
  5. PYTHON_REQ_USE="tk"
  6. inherit distutils-r1 eutils fdo-mime flag-o-matic versionator
  7. DESCRIPTION="A Python-extensible molecular graphics system"
  8. HOMEPAGE="http://www.pymol.org/"
  9. SRC_URI="
  10. https://dev.gentoo.org/~jlec/distfiles/${P}.png.xz
  11. mirror://sourceforge/project/${PN}/${PN}/$(get_version_component_range 1-2)/${PN}-v${PV}.tar.bz2
  12. "
  13. # git archive -v --prefix=${P}/ master -o ${P}.tar.xz
  14. RESTRICT="mirror"
  15. LICENSE="PSF-2.2"
  16. SLOT="0"
  17. KEYWORDS="amd64 ppc x86 ~amd64-linux ~x86-linux ~x64-macos ~x86-macos"
  18. IUSE="web"
  19. DEPEND="
  20. dev-python/numpy[${PYTHON_USEDEP}]
  21. dev-python/pyopengl[${PYTHON_USEDEP}]
  22. media-libs/freeglut
  23. media-libs/freetype:2
  24. media-libs/glew:0=
  25. media-libs/libpng:0=
  26. media-video/mpeg-tools
  27. sys-libs/zlib
  28. virtual/python-pmw[${PYTHON_USEDEP}]
  29. !sci-chemistry/pymol-apbs-plugin[${PYTHON_USEDEP}]
  30. web? ( !dev-python/webpy[${PYTHON_USEDEP}] )"
  31. RDEPEND="${DEPEND}"
  32. S="${WORKDIR}"/${PN}
  33. python_prepare_all() {
  34. sed \
  35. -e "s:\"/usr:\"${EPREFIX}/usr:g" \
  36. -e "/ext_comp_args.*+=/s:\[.*\]$:\[\]:g" \
  37. -e "/import/s:argparse:argparseX:g" \
  38. -i setup.py || die
  39. sed \
  40. -e "s:/opt/local:${EPREFIX}/usr:g" \
  41. -e '/ext_comp_args/s:\[.*\]:[]:g' \
  42. -i setup.py || die
  43. append-cxxflags -std=c++0x
  44. distutils-r1_python_prepare_all
  45. }
  46. python_install() {
  47. distutils-r1_python_install --pymol-path="${EPREFIX}/usr/share/pymol"
  48. sed \
  49. -e '1d' \
  50. -e "/APBS_BINARY_LOCATION/s:None:\"${EPREFIX}/usr/bin/apbs\":g" \
  51. -e "/APBS_PSIZE_LOCATION/s:None:\"$(python_get_sitedir)/pdb2pqr/src/\":g" \
  52. -e "/APBS_PDB2PQR_LOCATION/s:None:\"$(python_get_sitedir)/pdb2pqr/\":g" \
  53. -i "${D}/$(python_get_sitedir)"/pmg_tk/startup/apbs_tools.py || die
  54. }
  55. python_install_all() {
  56. distutils-r1_python_install_all
  57. sed \
  58. -e '1i#!/usr/bin/env python' \
  59. "${D}/$(python_get_sitedir)"/pymol/__init__.py > "${T}"/${PN} || die
  60. python_foreach_impl python_doscript "${T}"/${PN}
  61. # These environment variables should not go in the wrapper script, or else
  62. # it will be impossible to use the PyMOL libraries from Python.
  63. cat >> "${T}"/20pymol <<- EOF
  64. PYMOL_PATH="${EPREFIX}/usr/share/pymol"
  65. PYMOL_DATA="${EPREFIX}/usr/share/pymol/data"
  66. PYMOL_SCRIPTS="${EPREFIX}/usr/share/pymol/scripts"
  67. EOF
  68. doenvd "${T}"/20pymol
  69. newicon "${WORKDIR}"/${P}.png ${PN}.png
  70. make_desktop_entry ${PN} PyMol ${PN} \
  71. "Graphics;Education;Science;Chemistry;" \
  72. "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;"
  73. if ! use web; then
  74. rm -rf "${D}/$(python_get_sitedir)/web" || die
  75. fi
  76. rm -f "${ED}"/usr/share/${PN}/LICENSE || die
  77. }
  78. pkg_postinst() {
  79. fdo-mime_desktop_database_update
  80. fdo-mime_mime_database_update
  81. optfeature "Electrostatic calculations" sci-chemistry/apbs sci-chemistry/pdb2pqr
  82. }
  83. pkg_postrm() {
  84. fdo-mime_desktop_database_update
  85. fdo-mime_mime_database_update
  86. }