1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 docutils,
6 fetchFromGitHub,
7 setuptools,
8 setuptools-scm,
9 pydantic,
10 pytestCheckHook,
11 pythonOlder,
12 rstcheck-core,
13 typer,
14 types-docutils,
15}:
16
17buildPythonPackage rec {
18 pname = "rstcheck";
19 version = "6.2.1";
20 pyproject = true;
21
22 disabled = pythonOlder "3.8";
23
24 src = fetchFromGitHub {
25 owner = "rstcheck";
26 repo = "rstcheck";
27 rev = "refs/tags/v${version}";
28 hash = "sha256-S04l+x/rIc/XSvq2lSKCQp6KK5mmKI2mOgPgJ3WKe5M=";
29 };
30
31 build-system = [
32 setuptools
33 setuptools-scm
34 ];
35
36 dependencies = [
37 docutils
38 rstcheck-core
39 types-docutils
40 pydantic
41 typer
42 ];
43
44 nativeCheckInputs = [ pytestCheckHook ];
45
46 disabledTests = lib.optionals stdenv.isDarwin [
47 # Disabled until https://github.com/rstcheck/rstcheck-core/issues/19 is resolved.
48 "test_error_without_config_file_macos"
49 "test_file_1_is_bad_without_config_macos"
50 ];
51
52 pythonImportsCheck = [ "rstcheck" ];
53
54 preCheck = ''
55 # The tests need to find and call the rstcheck executable
56 export PATH="$PATH:$out/bin";
57 '';
58
59 meta = with lib; {
60 description = "Checks syntax of reStructuredText and code blocks nested within it";
61 homepage = "https://github.com/myint/rstcheck";
62 changelog = "https://github.com/rstcheck/rstcheck/blob/v${version}/CHANGELOG.md";
63 license = licenses.mit;
64 maintainers = with maintainers; [ staccato ];
65 mainProgram = "rstcheck";
66 };
67}