From f03da2128b987e374995552d653cf5e17b082c65 Mon Sep 17 00:00:00 2001 From: samlich <1349989+samlich@users.noreply.github.com> Date: Sun, 16 Feb 2025 19:11:43 +0100 Subject: [PATCH] pymol: 3.0.0 -> 3.1.0, fix msgpack on non-Darwin --- .../science/chemistry/pymol/default.nix | 79 ++++++++++++------- .../pymol/script-already-exists.patch | 23 ++++++ pkgs/top-level/all-packages.nix | 4 +- 3 files changed, 73 insertions(+), 33 deletions(-) create mode 100644 pkgs/applications/science/chemistry/pymol/script-already-exists.patch diff --git a/pkgs/applications/science/chemistry/pymol/default.nix b/pkgs/applications/science/chemistry/pymol/default.nix index 2a02d4aed2f7..27cedfb1e044 100644 --- a/pkgs/applications/science/chemistry/pymol/default.nix +++ b/pkgs/applications/science/chemistry/pymol/default.nix @@ -3,6 +3,7 @@ lib, fetchFromGitHub, makeDesktopItem, + cmake, python3Packages, netcdf, glew, @@ -10,6 +11,7 @@ libpng, libxml2, freetype, + mmtf-cpp, msgpack, qt5, }: @@ -43,37 +45,51 @@ let in python3Packages.buildPythonApplication rec { inherit pname; - version = "3.0.0"; + version = "3.1.0"; pyproject = true; src = fetchFromGitHub { owner = "schrodinger"; repo = "pymol-open-source"; rev = "v${version}"; - hash = "sha256-GhTHxacjGN7XklZ6gileBMRZAGq4Pp4JknNL+qGqrVE="; + hash = "sha256-2C9kUpNfK9g7ehmk83iUVqqz4gn4wKO3lW5rSduFP6U="; }; + # A script is already created by the `[project.scripts]` directive + # in `pyproject.toml`. + patches = [ ./script-already-exists.patch ]; + postPatch = '' substituteInPlace setup.py \ --replace-fail "self.install_libbase" '"${placeholder "out"}/${python3Packages.python.sitePackages}"' ''; - build-system = [ - python3Packages.setuptools + env.PREFIX_PATH = lib.optionalString (!stdenv.hostPlatform.isDarwin) "${msgpack}"; + build-system = [ python3Packages.setuptools ]; + dontUseCmakeConfigure = true; + + nativeBuildInputs = [ + cmake + qt5.wrapQtAppsHook ]; - nativeBuildInputs = [ qt5.wrapQtAppsHook ]; - buildInputs = [ - python3Packages.numpy - python3Packages.pyqt5 - glew - glm - libpng - libxml2 - freetype - msgpack - netcdf - ]; + buildInputs = + [ + python3Packages.numpy_1 + python3Packages.pyqt5 + qt5.qtbase + glew + glm + libpng + libxml2 + freetype + netcdf + ] + ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ + mmtf-cpp + msgpack + ]; + env.NIX_CFLAGS_COMPILE = "-I ${libxml2.dev}/include/libxml2"; postInstall = @@ -94,9 +110,7 @@ python3Packages.buildPythonApplication rec { cp -r "${desktopItem}/share/applications/" "$out/share/" ''; - pythonImportsCheck = [ - "pymol" - ]; + pythonImportsCheck = [ "pymol" ]; nativeCheckInputs = with python3Packages; [ python3Packages.msgpack @@ -112,17 +126,22 @@ python3Packages.buildPythonApplication rec { "tests/api/seqalign.py" ]; - disabledTests = [ - # the output image does not exactly match - "test_commands" - # touch the network - "testFetch" - # requires collada2gltf which is not included in nixpkgs - "testglTF" - # require mmtf-cpp which does not support darwin - "testMMTF" - "testSave_symmetry__mmtf" - ]; + disabledTests = + [ + # the output image does not exactly match + "test_commands" + # touch the network + "testFetch" + # requires collada2gltf which is not included in nixpkgs + "testglTF" + ] + ++ lib.optionals (stdenv.hostPlatform.isDarwin) [ + # require mmtf-cpp which does not support darwin + "test_bcif" + "test_bcif_array" + "testMMTF" + "testSave_symmetry__mmtf" + ]; preCheck = '' cd testing diff --git a/pkgs/applications/science/chemistry/pymol/script-already-exists.patch b/pkgs/applications/science/chemistry/pymol/script-already-exists.patch new file mode 100644 index 000000000000..d1ab6a5bc0de --- /dev/null +++ b/pkgs/applications/science/chemistry/pymol/script-already-exists.patch @@ -0,0 +1,23 @@ +diff --git a/setup.py b/setup.py +index 507dd32d..bf258897 100644 +--- a/setup.py ++++ b/setup.py +@@ -435,9 +435,6 @@ class install_pymol(install): + super().run() + self.install_pymol_path() + +- if not self.no_launcher: +- self.make_launch_script() +- + if self.bundled_pmw: + raise Exception( + "--bundled-pmw has been removed, please install Pmw from " +@@ -487,7 +484,7 @@ class install_pymol(install): + launch_script = os.path.join(self.install_scripts, launch_script) + + python_exe = os.path.abspath(sys.executable) +- site_packages_dir = sysconfig.get_path('purelib') ++ site_packages_dir = sysconfig.get_path("purelib") + pymol_file = self.unchroot( + os.path.join(site_packages_dir, "pymol", "__init__.py") + ) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a5d9e8ce8a00..55fc5d6331ae 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -16774,9 +16774,7 @@ with pkgs; pdb2pqr = with python3Packages; toPythonApplication pdb2pqr; - pymol = callPackage ../applications/science/chemistry/pymol { - python3Packages = python311Packages; - }; + pymol = callPackage ../applications/science/chemistry/pymol { }; quantum-espresso = callPackage ../applications/science/chemistry/quantum-espresso { hdf5 = hdf5-fortran;