From 3881e06a538c57c2a013caa356b6d9beb45380f2 Mon Sep 17 00:00:00 2001 From: Simon Hauser Date: Mon, 30 Sep 2024 09:24:52 +0200 Subject: [PATCH] libsbml: 5.20.2 -> 5.20.4 and add python support (#344137) Changelog: https://github.com/sbmlteam/libsbml/releases/tag/v5.20.4 --- pkgs/by-name/li/libsbml/package.nix | 30 ++++++++++++++--------------- pkgs/top-level/python-packages.nix | 4 ++++ 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/pkgs/by-name/li/libsbml/package.nix b/pkgs/by-name/li/libsbml/package.nix index 513e72f322bc..9fbb674f5d62 100644 --- a/pkgs/by-name/li/libsbml/package.nix +++ b/pkgs/by-name/li/libsbml/package.nix @@ -2,43 +2,35 @@ lib, stdenv, fetchFromGitHub, - fetchpatch, cmake, pkg-config, bzip2, libxml2, swig, + python ? null, + withPython ? false, }: stdenv.mkDerivation (attrs: { pname = "libsbml"; - version = "5.20.2"; + version = "5.20.4"; src = fetchFromGitHub { owner = "sbmlteam"; repo = "libsbml"; rev = "v${attrs.version}"; - hash = "sha256-8JT2r0zuf61VewtZaOAccaOUmDlQPnllA0fXE9rT5X8="; + hash = "sha256-qWTN033YU4iWzt+mXQaP5W/6IF5nebF4PwNVkyL8wTg="; }; - patches = [ - # This should be in next release, remember to remove fetchpatch - (fetchpatch { # https://github.com/sbmlteam/libsbml/pull/358 - name = "fix-xmlerror-conversion.patch"; - url = "https://github.com/sbmlteam/libsbml/commit/de2f77ee6766fe933a1472200f5e08e7c5ba6f8c.patch"; - hash = "sha256-uirG6XJ+w0hqBUEAGDnzhHoVtJVRdN1eqBYeneKMBao="; - }) - ]; - nativeBuildInputs = [ cmake pkg-config swig - ]; + ] ++ lib.optional withPython python.pkgs.pythonImportsCheckHook; buildInputs = [ bzip2.dev libxml2 - ]; + ] ++ lib.optional withPython python; # libSBML doesn't always make use of pkg-config cmakeFlags = [ @@ -46,13 +38,19 @@ stdenv.mkDerivation (attrs: { "-DLIBXML_LIBRARY=${lib.getLib libxml2}/lib/libxml2${stdenv.hostPlatform.extensions.sharedLibrary}" "-DPKG_CONFIG_EXECUTABLE=${lib.getBin pkg-config}/bin/pkg-config" "-DSWIG_EXECUTABLE=${lib.getBin swig}/bin/swig" - ]; + ] ++ lib.optional withPython "-DWITH_PYTHON=ON"; + + postInstall = lib.optional withPython '' + mv $out/${python.sitePackages}/libsbml/libsbml.py $out/${python.sitePackages}/libsbml/__init__.py + ''; + + pythonImportsCheck = [ "libsbml" ]; meta = with lib; { description = "Library for manipulating Systems Biology Markup Language (SBML)"; homepage = "https://github.com/sbmlteam/libsbml"; license = licenses.lgpl21Only; - maintainers = [maintainers.kupac]; + maintainers = [ maintainers.kupac ]; platforms = platforms.all; }; }) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 6a22ba955f59..567c5866bc37 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -7132,6 +7132,10 @@ self: super: with self; { libsavitar = callPackage ../development/python-modules/libsavitar { }; + libsbml = toPythonModule (pkgs.libsbml.override { + withPython = true; + inherit (self) python; + }); libsixel = callPackage ../development/python-modules/libsixel { inherit (pkgs) libsixel;