2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
# needed to build
|
|
|
|
cython,
|
|
|
|
oldest-supported-numpy,
|
|
|
|
setuptools,
|
|
|
|
setuptools-scm,
|
|
|
|
wheel,
|
|
|
|
# needed to run
|
|
|
|
astropy,
|
|
|
|
numpy,
|
|
|
|
pyparsing,
|
|
|
|
# needed to check
|
|
|
|
pytestCheckHook,
|
|
|
|
pytest-astropy,
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pyregion";
|
2024-01-02 11:29:13 +00:00
|
|
|
version = "2.2.0";
|
|
|
|
pyproject = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-03-20 04:20:00 +00:00
|
|
|
# pypi src contains cython-produced .c files which don't compile
|
|
|
|
# with python3.9
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "astropy";
|
|
|
|
repo = pname;
|
2024-01-02 11:29:13 +00:00
|
|
|
rev = version;
|
|
|
|
hash = "sha256-r2STKnZwNvonXATrQ5q9NVD9QftlWI1RWl4F+GZSxVg=";
|
|
|
|
};
|
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
env = lib.optionalAttrs stdenv.cc.isClang {
|
2024-01-02 11:29:13 +00:00
|
|
|
# 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";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
astropy
|
2024-01-02 11:29:13 +00:00
|
|
|
numpy
|
|
|
|
pyparsing
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cython
|
|
|
|
oldest-supported-numpy
|
|
|
|
setuptools
|
|
|
|
setuptools-scm
|
|
|
|
wheel
|
2021-02-05 17:12:51 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeCheckInputs = [
|
|
|
|
pytestCheckHook
|
|
|
|
pytest-astropy
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# Tests must be run in the build directory
|
2021-03-20 04:20:00 +00:00
|
|
|
preCheck = ''
|
|
|
|
pushd build/lib.*
|
|
|
|
'';
|
|
|
|
postCheck = ''
|
|
|
|
popd
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
2024-01-02 11:29:13 +00:00
|
|
|
changelog = "https://github.com/astropy/pyregion/blob/${version}/CHANGES.rst";
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Python parser for ds9 region files";
|
|
|
|
homepage = "https://github.com/astropy/pyregion";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = [ maintainers.smaret ];
|
|
|
|
};
|
|
|
|
}
|