From 1541a0306939b9fead6eb8f3b9c3e861e3c09800 Mon Sep 17 00:00:00 2001 From: natsukium Date: Fri, 19 Apr 2024 23:30:13 +0900 Subject: [PATCH 1/5] pymol: 2.5.0 -> 3.0.0 Diff: https://github.com/schrodinger/pymol-open-source/compare/v2.5.0...v3.0.0 --- pkgs/applications/science/chemistry/pymol/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/science/chemistry/pymol/default.nix b/pkgs/applications/science/chemistry/pymol/default.nix index 0e4728dd65d6..fcae70149392 100644 --- a/pkgs/applications/science/chemistry/pymol/default.nix +++ b/pkgs/applications/science/chemistry/pymol/default.nix @@ -38,12 +38,12 @@ let in python3Packages.buildPythonApplication rec { inherit pname; - version = "2.5.0"; + version = "3.0.0"; src = fetchFromGitHub { owner = "schrodinger"; repo = "pymol-open-source"; rev = "v${version}"; - sha256 = "sha256-JdsgcVF1w1xFPZxVcyS+GcWg4a1Bd4SvxFOuSdlz9SM="; + hash = "sha256-GhTHxacjGN7XklZ6gileBMRZAGq4Pp4JknNL+qGqrVE="; }; nativeBuildInputs = [ qt5.wrapQtAppsHook ]; From 1bb46ec3c6475ccbb2390828ca362e0dbb08b682 Mon Sep 17 00:00:00 2001 From: natsukium Date: Sat, 20 Apr 2024 10:37:01 +0900 Subject: [PATCH 2/5] pymol: modernize --- .../science/chemistry/pymol/default.nix | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/pkgs/applications/science/chemistry/pymol/default.nix b/pkgs/applications/science/chemistry/pymol/default.nix index fcae70149392..b0f6adf1f933 100644 --- a/pkgs/applications/science/chemistry/pymol/default.nix +++ b/pkgs/applications/science/chemistry/pymol/default.nix @@ -39,6 +39,8 @@ in python3Packages.buildPythonApplication rec { inherit pname; version = "3.0.0"; + pyproject = true; + src = fetchFromGitHub { owner = "schrodinger"; repo = "pymol-open-source"; @@ -46,22 +48,27 @@ python3Packages.buildPythonApplication rec { hash = "sha256-GhTHxacjGN7XklZ6gileBMRZAGq4Pp4JknNL+qGqrVE="; }; + postPatch = '' + substituteInPlace setup.py \ + --replace-fail "self.install_libbase" '"${placeholder "out"}/${python3.sitePackages}"' + ''; + + build-system = [ + python3Packages.setuptools + ]; + nativeBuildInputs = [ qt5.wrapQtAppsHook ]; buildInputs = [ python3Packages.numpy python3Packages.pyqt5 glew glm libpng libxml2 freetype msgpack netcdf ]; env.NIX_CFLAGS_COMPILE = "-I ${libxml2.dev}/include/libxml2"; hardeningDisable = [ "format" ]; - installPhase = '' - python setup.py install --home="$out" - runHook postInstall - ''; - postInstall = with python3Packages; '' wrapProgram $out/bin/pymol \ --prefix PYTHONPATH : ${lib.makeSearchPathOutput "lib" python3.sitePackages [ pyqt5 pyqt5.pyqt5-sip ]} mkdir -p "$out/share/icons/" - ln -s ../../lib/python/pymol/pymol_path/data/pymol/icons/icon2.svg "$out/share/icons/pymol.svg" + ln -s $out/${python3.sitePackages}/pymol/pymol_path/data/pymol/icons/icon2.svg "$out/share/icons/pymol.svg" + '' + lib.optionalString stdenv.hostPlatform.isLinux '' cp -r "${desktopItem}/share/applications/" "$out/share/" ''; From f97361a613bd2efd07f151b4fcdb841c715197bd Mon Sep 17 00:00:00 2001 From: natsukium Date: Sat, 20 Apr 2024 12:11:41 +0900 Subject: [PATCH 3/5] pymol: enable tests --- .../science/chemistry/pymol/default.nix | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/pkgs/applications/science/chemistry/pymol/default.nix b/pkgs/applications/science/chemistry/pymol/default.nix index b0f6adf1f933..a34b046d11d2 100644 --- a/pkgs/applications/science/chemistry/pymol/default.nix +++ b/pkgs/applications/science/chemistry/pymol/default.nix @@ -72,6 +72,42 @@ python3Packages.buildPythonApplication rec { cp -r "${desktopItem}/share/applications/" "$out/share/" ''; + pythonImportsCheck = [ + "pymol" + ]; + + nativeCheckInputs = with python3Packages; [ + python3Packages.msgpack + pillow + pytestCheckHook + ]; + + # some tests hang for some reason + doCheck = !(stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64); + + disabledTestPaths = [ + # require biopython which is broken as of 2024-04-20 + "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" + ]; + + preCheck = '' + cd testing + ''; + + __darwinAllowLocalNetworking = true; + preFixup = '' wrapQtApp "$out/bin/pymol" ''; From 2a5ba3d551100da94166185de58dc1271d686b06 Mon Sep 17 00:00:00 2001 From: natsukium Date: Sat, 20 Apr 2024 13:46:58 +0900 Subject: [PATCH 4/5] pymol: add natsukium as maintainer --- pkgs/applications/science/chemistry/pymol/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/science/chemistry/pymol/default.nix b/pkgs/applications/science/chemistry/pymol/default.nix index a34b046d11d2..63ee52c6ed41 100644 --- a/pkgs/applications/science/chemistry/pymol/default.nix +++ b/pkgs/applications/science/chemistry/pymol/default.nix @@ -117,6 +117,6 @@ python3Packages.buildPythonApplication rec { mainProgram = "pymol"; homepage = "https://www.pymol.org/"; license = licenses.mit; - maintainers = with maintainers; [ samlich ]; + maintainers = with maintainers; [ natsukium samlich ]; }; } From 472ce9672efe95641c2786f713bde169de2eb4a9 Mon Sep 17 00:00:00 2001 From: samlich <1349989+samlich@users.noreply.github.com> Date: Wed, 24 Apr 2024 23:43:57 +0200 Subject: [PATCH 5/5] pymol: remove no longer needed `disableHardening` --- pkgs/applications/science/chemistry/pymol/default.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/pkgs/applications/science/chemistry/pymol/default.nix b/pkgs/applications/science/chemistry/pymol/default.nix index 63ee52c6ed41..1733ba2f236c 100644 --- a/pkgs/applications/science/chemistry/pymol/default.nix +++ b/pkgs/applications/science/chemistry/pymol/default.nix @@ -60,7 +60,6 @@ python3Packages.buildPythonApplication rec { nativeBuildInputs = [ qt5.wrapQtAppsHook ]; buildInputs = [ python3Packages.numpy python3Packages.pyqt5 glew glm libpng libxml2 freetype msgpack netcdf ]; env.NIX_CFLAGS_COMPILE = "-I ${libxml2.dev}/include/libxml2"; - hardeningDisable = [ "format" ]; postInstall = with python3Packages; '' wrapProgram $out/bin/pymol \