Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / python-modules / pyregion / default.nix
blob30c63528514f22b6ea7f0a16f0175458d43f3d20
1 { lib
2 , stdenv
3 , buildPythonPackage
4 , fetchFromGitHub
5 , fetchpatch
6 , pyparsing
7 , numpy
8 , cython
9 , astropy
10 , astropy-helpers
11 , pytestCheckHook
12 , pytest-astropy
15 buildPythonPackage rec {
16   pname = "pyregion";
17   version = "2.1.1";
19   # pypi src contains cython-produced .c files which don't compile
20   # with python3.9
21   src = fetchFromGitHub {
22     owner = "astropy";
23     repo = pname;
24     rev = "v${version}";
25     hash = "sha256-xo+XbBJ2HKql9rd7Ma84JofRg8M4u6vmz44Qo8JhEBc=";
26   };
28   propagatedBuildInputs = [
29     pyparsing
30     numpy
31     astropy
32     cython
33   ];
35   # Upstream patches needed for the tests to pass
36   # See https://github.com/astropy/pyregion/pull/157/
37   patches = [
38     (fetchpatch {
39       url = "https://github.com/astropy/pyregion/pull/157/commits/082649730d353a0d0c0ee9619be1aa501aabba62.patch";
40       hash = "sha256-4mHZt3S29ZfK+QKavm6DLBwVxGl/ga7W7GEcQ5ewxuo=";
41     })
42     (fetchpatch {
43       url = "https://github.com/astropy/pyregion/pull/157/commits/c448a465dd56887979da62aec6138fc89bb37b19.patch";
44       hash = "sha256-GEtvScmVbAdE4E5Xx0hNOPommvzcnJ3jNZpBmY3PbyE=";
45     })
46   ];
48   nativeBuildInputs = [ astropy-helpers cython ];
50   nativeCheckInputs = [ pytestCheckHook pytest-astropy ];
52   disabledTests = lib.optionals (!stdenv.hostPlatform.isDarwin) [
53     # Skipping 2 tests because it's failing. Domain knowledge was unavailable on decision.
54     # Error logs: https://gist.github.com/superherointj/3f616f784014eeb2e3039b0f4037e4e9
55     "test_calculate_rotation_angle"
56     "test_region"
57   ];
59   # Disable automatic update of the astropy-helper module
60   postPatch = ''
61     substituteInPlace setup.cfg --replace "auto_use = True" "auto_use = False"
62   '';
64   # Tests must be run in the build directory
65   preCheck = ''
66     pushd build/lib.*
67   '';
68   postCheck = ''
69     popd
70   '';
72   meta = with lib; {
73     description = "Python parser for ds9 region files";
74     homepage = "https://github.com/astropy/pyregion";
75     license = licenses.mit;
76     maintainers = [ maintainers.smaret ];
77   };