summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/pyregion/default.nix
blob: 3fb0bc09fef25710bb55e4f28cbe70de41875fdc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
{
  lib,
  stdenv,
  buildPythonPackage,
  fetchFromGitHub,
  # needed to build
  cython,
  extension-helpers,
  oldest-supported-numpy,
  setuptools,
  setuptools-scm,
  # needed to run
  astropy,
  numpy,
  pyparsing,
  # needed to check
  pytestCheckHook,
  pytest-astropy,
}:

buildPythonPackage rec {
  pname = "pyregion";
  version = "2.3.0";
  pyproject = true;

  # pypi src contains cython-produced .c files which don't compile
  # with python3.9
  src = fetchFromGitHub {
    owner = "astropy";
    repo = "pyregion";
    tag = "v${version}";
    hash = "sha256-mEO2PbUSTVy7Qmm723/lGL6PYQzbRazIPZH51SWebvs=";
  };

  dependencies = [
    astropy
    numpy
    pyparsing
  ];

  build-system = [
    cython
    extension-helpers
    oldest-supported-numpy
    setuptools
    setuptools-scm
  ];

  nativeCheckInputs = [
    pytestCheckHook
    pytest-astropy
  ];

  # Tests must be run in the build directory
  preCheck = ''
    pushd build/lib.*
  '';
  postCheck = ''
    popd
  '';

  meta = {
    changelog = "https://github.com/astropy/pyregion/blob/${src.tag}/CHANGES.rst";
    description = "Python parser for ds9 region files";
    homepage = "https://github.com/astropy/pyregion";
    license = lib.licenses.mit;
    maintainers = [ lib.maintainers.smaret ];
  };
}