From 29d3a57806b9aff4dcff258fff9a156fd880b30c Mon Sep 17 00:00:00 2001 From: "Robert T. McGibbon" Date: Fri, 26 Mar 2021 14:15:41 -0400 Subject: [PATCH] python39Packages.pyregion: unbreak (#117630) --- .../python-modules/pyregion/default.nix | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/pkgs/development/python-modules/pyregion/default.nix b/pkgs/development/python-modules/pyregion/default.nix index 86a5ef6bfe0..6d33e18e4f9 100644 --- a/pkgs/development/python-modules/pyregion/default.nix +++ b/pkgs/development/python-modules/pyregion/default.nix @@ -1,13 +1,13 @@ { lib , buildPythonPackage -, fetchPypi +, fetchFromGitHub , fetchpatch , pyparsing , numpy , cython , astropy , astropy-helpers -, pytest +, pytestCheckHook , pytest-astropy }: @@ -15,15 +15,18 @@ buildPythonPackage rec { pname = "pyregion"; version = "2.0"; - src = fetchPypi { - inherit pname version; - sha256 = "a8ac5f764b53ec332f6bc43f6f2193ca13e8b7d5a3fb2e20ced6b2ea42a9d094"; + # pypi src contains cython-produced .c files which don't compile + # with python3.9 + src = fetchFromGitHub { + owner = "astropy"; + repo = pname; + rev = version; + sha256 = "1izar7z606czcyws9s8bjbpb1xhqshpv5009rlpc92hciw7jv4kg"; }; propagatedBuildInputs = [ pyparsing numpy - cython astropy ]; @@ -36,9 +39,9 @@ buildPythonPackage rec { }) ]; - nativeBuildInputs = [ astropy-helpers ]; + nativeBuildInputs = [ astropy-helpers cython ]; - checkInputs = [ pytest pytest-astropy ]; + checkInputs = [ pytestCheckHook pytest-astropy ]; # Disable automatic update of the astropy-helper module postPatch = '' @@ -46,9 +49,11 @@ buildPythonPackage rec { ''; # Tests must be run in the build directory - checkPhase = '' - cd build/lib.* - pytest + preCheck = '' + pushd build/lib.* + ''; + postCheck = '' + popd ''; meta = with lib; {