Unverified Commit 6d9211ae authored by Amadej Kastelic's avatar Amadej Kastelic
Browse files

pymol: fix build

parent 03316b4b
Loading
Loading
Loading
Loading
+24 −2
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
  stdenv,
  lib,
  fetchFromGitHub,
  fetchpatch,
  makeDesktopItem,
  cmake,
  python3Packages,
@@ -57,11 +58,31 @@ python3Packages.buildPythonApplication rec {

  # A script is already created by the `[project.scripts]` directive
  # in `pyproject.toml`.
  patches = [ ./script-already-exists.patch ];
  patches = [ 
    ./script-already-exists.patch

    # Fix python3.13 and numpy 2 compatibility
    (fetchpatch {
      url="https://github.com/schrodinger/pymol-open-source/commit/fef4a026425d195185e84d46ab88b2bbd6d96cf8.patch";
      hash = "sha256-F/5UcYwgHgcMQ+zeigedc1rr3WkN9rhxAxH+gQfWKIY=";
    })
    (fetchpatch {
      url="https://github.com/schrodinger/pymol-open-source/commit/97cc1797695ee0850621762491e93dc611b04165.patch";
      hash = "sha256-H2PsRFn7brYTtLff/iMvJbZ+RZr7GYElMSINa4RDYdA=";
    })
    # Fixes failing test testLoadPWG
    (fetchpatch {
      url="https://github.com/schrodinger/pymol-open-source/commit/17c6cbd96d52e9692fd298daec6c9bda273a8aad.patch";
      hash = "sha256-dcYRzUhiaGlR3CjQ0BktA5L+8lFyVdw0+hIz3Li7gDQ=";
    })
  ];

  postPatch = ''
    substituteInPlace setup.py \
      --replace-fail "self.install_libbase" '"${placeholder "out"}/${python3Packages.python.sitePackages}"'

    substituteInPlace pyproject.toml \
      --replace-fail '"cmake>=3.13.3",' ""
  '';

  env.PREFIX_PATH = lib.optionalString (!stdenv.hostPlatform.isDarwin) "${msgpack}";
@@ -74,7 +95,7 @@ python3Packages.buildPythonApplication rec {
  ];

  buildInputs = [
    python3Packages.numpy_1
    python3Packages.numpy
    python3Packages.pyqt5
    qt5.qtbase
    glew
@@ -115,6 +136,7 @@ python3Packages.buildPythonApplication rec {
    python3Packages.msgpack
    pillow
    pytestCheckHook
    requests
  ];

  # some tests hang for some reason