From f85aff5a2215d154781ce05e59abcb96bf1844ef Mon Sep 17 00:00:00 2001 From: Victor multun Collod Date: Sun, 29 Dec 2019 13:55:12 +0100 Subject: [PATCH] pythonPackages.prox-tv: init at 3.3.0 --- .../python-modules/prox-tv/default.nix | 50 +++++++++++++++++++ .../python-modules/prox-tv/use-openblas.patch | 11 ++++ pkgs/top-level/python-packages.nix | 6 +++ 3 files changed, 67 insertions(+) create mode 100644 pkgs/development/python-modules/prox-tv/default.nix create mode 100644 pkgs/development/python-modules/prox-tv/use-openblas.patch diff --git a/pkgs/development/python-modules/prox-tv/default.nix b/pkgs/development/python-modules/prox-tv/default.nix new file mode 100644 index 000000000000..2568620f5393 --- /dev/null +++ b/pkgs/development/python-modules/prox-tv/default.nix @@ -0,0 +1,50 @@ +{ lib +, blas +, buildPythonPackage +, cffi +, fetchFromGitHub +, liblapack +, nose +, numpy +, openblas +, useOpenblas ? true +}: + +buildPythonPackage { + pname = "prox-tv"; + version = "3.3.0"; + + src = fetchFromGitHub { + owner = "albarji"; + repo = "proxTV"; + rev = "e621585d5aaa7983fbee68583f7deae995d3bafb"; + sha256 = "0mlrjbb5rw78dgijkr3bspmsskk6jqs9y7xpsgs35i46dvb327q5"; + }; + + patches = lib.optional useOpenblas ./use-openblas.patch; + + checkInputs = [ + nose + ]; + + propagatedBuildInputs = [ + numpy + cffi + ]; + + buildInputs = ( + if useOpenblas then + [ openblas ] + else + [ blas liblapack ] + ); + + enableParallelBuilding = true; + + meta = with lib; { + homepage = https://github.com/albarji/proxTV; + description = "A toolbox for fast Total Variation proximity operators"; + license = licenses.bsd2; + maintainers = with maintainers; [ multun ]; + }; +} diff --git a/pkgs/development/python-modules/prox-tv/use-openblas.patch b/pkgs/development/python-modules/prox-tv/use-openblas.patch new file mode 100644 index 000000000000..e96faa4d6000 --- /dev/null +++ b/pkgs/development/python-modules/prox-tv/use-openblas.patch @@ -0,0 +1,11 @@ +index f100b35..448bbaf 100644 +--- a/prox_tv/prox_tv_build.py ++++ b/prox_tv/prox_tv_build.py +@@ -109,6 +109,6 @@ ffi.set_source( + define_macros=[('NOMATLAB', 1)], + extra_compile_args=extra_compile_args, + extra_link_args=extra_link_args, +- libraries=['blas', 'lapack'], ++ libraries=['openblas'], + include_dirs=['/usr/include'] + ) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index cd535c9f3d61..f64d276dde25 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -4529,6 +4529,12 @@ in { precis-i18n = callPackage ../development/python-modules/precis-i18n { }; + prox-tv = callPackage ../development/python-modules/prox-tv { + # We need to use blas instead of openblas on darwin, + # see https://github.com/NixOS/nixpkgs/pull/45013. + useOpenblas = ! stdenv.isDarwin; + }; + pvlib = callPackage ../development/python-modules/pvlib { }; pybase64 = callPackage ../development/python-modules/pybase64 { };