2019-02-25 14:36:56 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
2021-03-26 18:15:41 +00:00
|
|
|
, fetchFromGitHub
|
2019-07-23 12:50:29 +01:00
|
|
|
, fetchpatch
|
2019-02-25 14:36:56 +00:00
|
|
|
, pyparsing
|
|
|
|
, numpy
|
|
|
|
, cython
|
|
|
|
, astropy
|
2019-07-23 12:50:29 +01:00
|
|
|
, astropy-helpers
|
2021-03-26 18:15:41 +00:00
|
|
|
, pytestCheckHook
|
2019-07-23 12:50:29 +01:00
|
|
|
, pytest-astropy
|
2019-02-25 14:36:56 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pyregion";
|
|
|
|
version = "2.0";
|
|
|
|
|
2021-03-26 18:15:41 +00:00
|
|
|
# pypi src contains cython-produced .c files which don't compile
|
|
|
|
# with python3.9
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "astropy";
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
|
|
|
sha256 = "1izar7z606czcyws9s8bjbpb1xhqshpv5009rlpc92hciw7jv4kg";
|
2019-02-25 14:36:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
pyparsing
|
|
|
|
numpy
|
|
|
|
astropy
|
|
|
|
];
|
|
|
|
|
2019-07-23 12:50:29 +01:00
|
|
|
# Upstream patch needed for the test to pass
|
|
|
|
patches = [
|
|
|
|
(fetchpatch {
|
|
|
|
name = "conftest-astropy-3-fix.patch";
|
|
|
|
url = "https://github.com/astropy/pyregion/pull/136.patch";
|
|
|
|
sha256 = "13yxjxiqnhjy9gh24hvv6pnwx7qic2mcx3ccr1igjrc3f881d59m";
|
2021-01-21 00:55:55 +00:00
|
|
|
})
|
|
|
|
];
|
2019-07-23 12:50:29 +01:00
|
|
|
|
2021-03-26 18:15:41 +00:00
|
|
|
nativeBuildInputs = [ astropy-helpers cython ];
|
2019-07-23 12:50:29 +01:00
|
|
|
|
2021-03-26 18:15:41 +00:00
|
|
|
checkInputs = [ pytestCheckHook pytest-astropy ];
|
2019-07-23 12:50:29 +01:00
|
|
|
|
|
|
|
# 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
|
2021-03-26 18:15:41 +00:00
|
|
|
preCheck = ''
|
|
|
|
pushd build/lib.*
|
|
|
|
'';
|
|
|
|
postCheck = ''
|
|
|
|
popd
|
2019-07-23 12:50:29 +01:00
|
|
|
'';
|
|
|
|
|
2019-02-25 14:36:56 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Python parser for ds9 region files";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://github.com/astropy/pyregion";
|
2019-02-25 14:36:56 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = [ maintainers.smaret ];
|
|
|
|
};
|
|
|
|
}
|