about summary refs log tree commit diff
path: root/pkgs/development/python-modules/rstcheck-core/default.nix
blob: 345c08c9681a23314c06493fe82a7ef42c380c8d (plain) (blame)
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
70
71
72
73
{ stdenv
, lib
, buildPythonPackage
, docutils
, fetchFromGitHub
, importlib-metadata
, mock
, pydantic
, pytest-mock
, pytestCheckHook
, pythonOlder
, setuptools
, setuptools-scm
, typing-extensions
, wheel
}:

buildPythonPackage rec {
  pname = "rstcheck-core";
  version = "1.2.0";
  pyproject = true;

  disabled = pythonOlder "3.8";

  src = fetchFromGitHub {
    owner = "rstcheck";
    repo = "rstcheck-core";
    rev = "refs/tags/v${version}";
    hash = "sha256-cKJNktIB4vXt1MPRgYrJQ0aksmrVu7Y2uTyUjdx5YdA=";
  };

  nativeBuildInputs = [
    setuptools
    setuptools-scm
    wheel
  ];

  env = {
    SETUPTOOLS_SCM_PRETEND_VERSION = version;
    NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-strict-prototypes";
  };

  propagatedBuildInputs = [
    docutils
    pydantic
  ] ++ lib.optionals (pythonOlder "3.9") [
    importlib-metadata
    typing-extensions
  ];

  nativeCheckInputs = [
    mock
    pytest-mock
    pytestCheckHook
  ];

  disabledTests = [
    # https://github.com/rstcheck/rstcheck-core/issues/84
    "test_check_yaml_returns_error_on_bad_code_block"
  ];

  pythonImportsCheck = [
    "rstcheck_core"
  ];

  meta = with lib; {
    description = "Library for checking syntax of reStructuredText";
    homepage = "https://github.com/rstcheck/rstcheck-core";
    changelog = "https://github.com/rstcheck/rstcheck-core/blob/v${version}/CHANGELOG.md";
    license = licenses.mit;
    maintainers = with maintainers; [ fab ];
  };
}