summary refs log tree commit diff
diff options
context:
space:
mode:
authorEmily Trau <13267947+emilytrau@users.noreply.github.com>2023-11-30 00:11:05 +1100
committerGitHub <noreply@github.com>2023-11-30 00:11:05 +1100
commit50aa30a13c4ab5e7ba282da460a3e3d44e9d0eb3 (patch)
tree88ea901022a24a4b6436c71ed1aa62cab6cb066d
parent48579be8c74fbb4ea0937e1fbf5bb99431c16b5a (diff)
parent3b03a8d30440c388313e5f8dacbdfbe49ffd5be6 (diff)
Merge pull request #270930 from NixOS/backport-270851-to-release-23.11
[Backport release-23.11] python311Packages.pot: pypi missing files, switch to github; fixbuild
-rw-r--r--pkgs/development/python-modules/pot/default.nix38
1 files changed, 17 insertions, 21 deletions
diff --git a/pkgs/development/python-modules/pot/default.nix b/pkgs/development/python-modules/pot/default.nix
index a6251b3ea4796..90aac0fef677c 100644
--- a/pkgs/development/python-modules/pot/default.nix
+++ b/pkgs/development/python-modules/pot/default.nix
@@ -1,10 +1,11 @@
 { lib
 , autograd
 , buildPythonPackage
+, fetchFromGitHub
 , cupy
 , cvxopt
 , cython
-, fetchPypi
+, oldest-supported-numpy
 , matplotlib
 , numpy
 , tensorflow
@@ -20,19 +21,20 @@
 buildPythonPackage rec {
   pname = "pot";
   version = "0.9.1";
-  format = "setuptools";
+  pyproject = true;
 
   disabled = pythonOlder "3.6";
 
-  src = fetchPypi {
-    pname = "POT";
-    inherit version;
-    hash = "sha256-gcJTJ6ABl/8Rwf5SIc8YGtHf/mFWRBUuLhFd3d9eWRs=";
+  src = fetchFromGitHub {
+    owner = "PythonOT";
+    repo = "POT";
+    rev = version;
+    hash = "sha256-D61/dqO16VvcQx4FG1beKR4y1OQHndwCizaugNaUe4g=";
   };
 
   nativeBuildInputs = [
-    numpy
     cython
+    oldest-supported-numpy
   ];
 
   propagatedBuildInputs = [
@@ -59,17 +61,19 @@ buildPythonPackage rec {
       --replace " --cov-report= --cov=ot" "" \
       --replace " --durations=20" "" \
       --replace " --junit-xml=junit-results.xml" ""
-    substituteInPlace setup.py \
-      --replace '"oldest-supported-numpy", ' ""
 
     # we don't need setup.py to find the macos sdk for us
     sed -i '/sdk_path/d' setup.py
   '';
 
-  # To prevent importing of an incomplete package from the build directory
-  # instead of nix store (`ot` is the top-level package name).
+  # need to run the tests with the built package next to the test directory
   preCheck = ''
-    rm -r ot
+    pushd build/lib.*
+    ln -s -t . "$OLDPWD/test"
+  '';
+
+  postCheck = ''
+    popd
   '';
 
   disabledTests = [
@@ -100,15 +104,7 @@ buildPythonPackage rec {
     "test_emd1d_device_tf"
   ];
 
-  disabledTestPaths = [
-    # AttributeError: module pytest has no attribute skip_backend
-    "test/test_bregman.py"
-    "test/test_da.py"
-    "test/test_utils.py"
-    "test/test_gromov.py"
-    "test/test_helpers.py"
-    "test/test_unbalanced.py"
-  ] ++ lib.optionals (!enableDimensionalityReduction) [
+  disabledTestPaths = lib.optionals (!enableDimensionalityReduction) [
     "test/test_dr.py"
   ];