about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJulien Malka <julien@malka.sh>2023-11-29 17:53:54 +0100
committerGitHub <noreply@github.com>2023-11-29 17:53:54 +0100
commitc4d1a77d1712d5e22db2448bf1070cf6ace4813b (patch)
tree526ad91f8ce506e2c29d1280ec417cab61a80c30
parentf8f87feb4ada8af7d83ee12a1bb2973f450b95bc (diff)
parent5a616273c0055da61a5f7badbc23afd2f8ae19b0 (diff)
Merge pull request #270511 from NixOS/backport-270042-to-release-23.11
[Backport release-23.11] python311Packages.pyregion: 2.1.1 -> 2.2.0; fix darwin build
-rw-r--r--pkgs/development/python-modules/pyregion/default.nix64
1 files changed, 30 insertions, 34 deletions
diff --git a/pkgs/development/python-modules/pyregion/default.nix b/pkgs/development/python-modules/pyregion/default.nix
index 30c63528514f2..6f1affd9063ee 100644
--- a/pkgs/development/python-modules/pyregion/default.nix
+++ b/pkgs/development/python-modules/pyregion/default.nix
@@ -3,64 +3,59 @@
 , buildPythonPackage
 , fetchFromGitHub
 , fetchpatch
-, pyparsing
-, numpy
+# needed to build
 , cython
+, oldest-supported-numpy
+, setuptools
+, setuptools-scm
+, wheel
+# needed to run
 , astropy
-, astropy-helpers
+, numpy
+, pyparsing
+# needed to check
 , pytestCheckHook
 , pytest-astropy
 }:
 
 buildPythonPackage rec {
   pname = "pyregion";
-  version = "2.1.1";
+  version = "2.2.0";
+  pyproject = true;
 
   # pypi src contains cython-produced .c files which don't compile
   # with python3.9
   src = fetchFromGitHub {
     owner = "astropy";
     repo = pname;
-    rev = "v${version}";
-    hash = "sha256-xo+XbBJ2HKql9rd7Ma84JofRg8M4u6vmz44Qo8JhEBc=";
+    rev = version;
+    hash = "sha256-r2STKnZwNvonXATrQ5q9NVD9QftlWI1RWl4F+GZSxVg=";
+  };
+
+  env = {
+    SETUPTOOLS_SCM_PRETEND_VERSION = version;
+  } // lib.optionalAttrs stdenv.cc.isClang {
+    # Try to remove on next update.  generated code returns a NULL in a
+    # function where an int is expected.
+    NIX_CFLAGS_COMPILE = "-Wno-error=int-conversion";
   };
 
   propagatedBuildInputs = [
-    pyparsing
-    numpy
     astropy
-    cython
+    numpy
+    pyparsing
   ];
 
-  # Upstream patches needed for the tests to pass
-  # See https://github.com/astropy/pyregion/pull/157/
-  patches = [
-    (fetchpatch {
-      url = "https://github.com/astropy/pyregion/pull/157/commits/082649730d353a0d0c0ee9619be1aa501aabba62.patch";
-      hash = "sha256-4mHZt3S29ZfK+QKavm6DLBwVxGl/ga7W7GEcQ5ewxuo=";
-    })
-    (fetchpatch {
-      url = "https://github.com/astropy/pyregion/pull/157/commits/c448a465dd56887979da62aec6138fc89bb37b19.patch";
-      hash = "sha256-GEtvScmVbAdE4E5Xx0hNOPommvzcnJ3jNZpBmY3PbyE=";
-    })
+  nativeBuildInputs = [
+    cython
+    oldest-supported-numpy
+    setuptools
+    setuptools-scm
+    wheel
   ];
 
-  nativeBuildInputs = [ astropy-helpers cython ];
-
   nativeCheckInputs = [ pytestCheckHook pytest-astropy ];
 
-  disabledTests = lib.optionals (!stdenv.hostPlatform.isDarwin) [
-    # Skipping 2 tests because it's failing. Domain knowledge was unavailable on decision.
-    # Error logs: https://gist.github.com/superherointj/3f616f784014eeb2e3039b0f4037e4e9
-    "test_calculate_rotation_angle"
-    "test_region"
-  ];
-
-  # Disable automatic update of the astropy-helper module
-  postPatch = ''
-    substituteInPlace setup.cfg --replace "auto_use = True" "auto_use = False"
-  '';
-
   # Tests must be run in the build directory
   preCheck = ''
     pushd build/lib.*
@@ -70,6 +65,7 @@ buildPythonPackage rec {
   '';
 
   meta = with lib; {
+    changelog = "https://github.com/astropy/pyregion/blob/${version}/CHANGES.rst";
     description = "Python parser for ds9 region files";
     homepage = "https://github.com/astropy/pyregion";
     license = licenses.mit;