Merge pull request #270042 from a-n-n-a-l-e-e/pyregion-fix

python311Packages.pyregion: 2.1.1 -> 2.2.0; fix darwin build

authored by Robert Scott and committed by GitHub 24d1305f 9eeeb192

+30 -34
+30 -34
pkgs/development/python-modules/pyregion/default.nix
··· 3 3 , buildPythonPackage 4 4 , fetchFromGitHub 5 5 , fetchpatch 6 - , pyparsing 7 - , numpy 6 + # needed to build 8 7 , cython 8 + , oldest-supported-numpy 9 + , setuptools 10 + , setuptools-scm 11 + , wheel 12 + # needed to run 9 13 , astropy 10 - , astropy-helpers 14 + , numpy 15 + , pyparsing 16 + # needed to check 11 17 , pytestCheckHook 12 18 , pytest-astropy 13 19 }: 14 20 15 21 buildPythonPackage rec { 16 22 pname = "pyregion"; 17 - version = "2.1.1"; 23 + version = "2.2.0"; 24 + pyproject = true; 18 25 19 26 # pypi src contains cython-produced .c files which don't compile 20 27 # with python3.9 21 28 src = fetchFromGitHub { 22 29 owner = "astropy"; 23 30 repo = pname; 24 - rev = "v${version}"; 25 - hash = "sha256-xo+XbBJ2HKql9rd7Ma84JofRg8M4u6vmz44Qo8JhEBc="; 31 + rev = version; 32 + hash = "sha256-r2STKnZwNvonXATrQ5q9NVD9QftlWI1RWl4F+GZSxVg="; 33 + }; 34 + 35 + env = { 36 + SETUPTOOLS_SCM_PRETEND_VERSION = version; 37 + } // lib.optionalAttrs stdenv.cc.isClang { 38 + # Try to remove on next update. generated code returns a NULL in a 39 + # function where an int is expected. 40 + NIX_CFLAGS_COMPILE = "-Wno-error=int-conversion"; 26 41 }; 27 42 28 43 propagatedBuildInputs = [ 29 - pyparsing 30 - numpy 31 44 astropy 32 - cython 45 + numpy 46 + pyparsing 33 47 ]; 34 48 35 - # Upstream patches needed for the tests to pass 36 - # See https://github.com/astropy/pyregion/pull/157/ 37 - patches = [ 38 - (fetchpatch { 39 - url = "https://github.com/astropy/pyregion/pull/157/commits/082649730d353a0d0c0ee9619be1aa501aabba62.patch"; 40 - hash = "sha256-4mHZt3S29ZfK+QKavm6DLBwVxGl/ga7W7GEcQ5ewxuo="; 41 - }) 42 - (fetchpatch { 43 - url = "https://github.com/astropy/pyregion/pull/157/commits/c448a465dd56887979da62aec6138fc89bb37b19.patch"; 44 - hash = "sha256-GEtvScmVbAdE4E5Xx0hNOPommvzcnJ3jNZpBmY3PbyE="; 45 - }) 49 + nativeBuildInputs = [ 50 + cython 51 + oldest-supported-numpy 52 + setuptools 53 + setuptools-scm 54 + wheel 46 55 ]; 47 56 48 - nativeBuildInputs = [ astropy-helpers cython ]; 49 - 50 57 nativeCheckInputs = [ pytestCheckHook pytest-astropy ]; 51 58 52 - disabledTests = lib.optionals (!stdenv.hostPlatform.isDarwin) [ 53 - # Skipping 2 tests because it's failing. Domain knowledge was unavailable on decision. 54 - # Error logs: https://gist.github.com/superherointj/3f616f784014eeb2e3039b0f4037e4e9 55 - "test_calculate_rotation_angle" 56 - "test_region" 57 - ]; 58 - 59 - # Disable automatic update of the astropy-helper module 60 - postPatch = '' 61 - substituteInPlace setup.cfg --replace "auto_use = True" "auto_use = False" 62 - ''; 63 - 64 59 # Tests must be run in the build directory 65 60 preCheck = '' 66 61 pushd build/lib.* ··· 70 65 ''; 71 66 72 67 meta = with lib; { 68 + changelog = "https://github.com/astropy/pyregion/blob/${version}/CHANGES.rst"; 73 69 description = "Python parser for ds9 region files"; 74 70 homepage = "https://github.com/astropy/pyregion"; 75 71 license = licenses.mit;