2020-04-24 23:36:52 +00:00
|
|
|
{ lib
|
2023-02-16 17:41:37 +00:00
|
|
|
, stdenv
|
2020-04-24 23:36:52 +00:00
|
|
|
, buildPythonPackage
|
2021-03-20 04:20:00 +00:00
|
|
|
, fetchFromGitHub
|
2020-04-24 23:36:52 +00:00
|
|
|
, fetchpatch
|
2024-01-02 11:29:13 +00:00
|
|
|
# needed to build
|
2020-04-24 23:36:52 +00:00
|
|
|
, cython
|
2024-01-02 11:29:13 +00:00
|
|
|
, oldest-supported-numpy
|
|
|
|
, setuptools
|
|
|
|
, setuptools-scm
|
|
|
|
, wheel
|
|
|
|
# needed to run
|
2020-04-24 23:36:52 +00:00
|
|
|
, astropy
|
2024-01-02 11:29:13 +00:00
|
|
|
, numpy
|
|
|
|
, pyparsing
|
|
|
|
# needed to check
|
2021-03-20 04:20:00 +00:00
|
|
|
, pytestCheckHook
|
2020-04-24 23:36:52 +00:00
|
|
|
, pytest-astropy
|
|
|
|
}:
|
|
|
|
|
|
|
|
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=";
|
|
|
|
};
|
|
|
|
|
|
|
|
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";
|
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
|
|
|
|
2023-02-02 18:25:31 +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 ];
|
|
|
|
};
|
|
|
|
}
|