1{ lib
2, stdenv
3, buildPythonApplication
4, fetchPypi
5, pytestCheckHook
6, pkg-config
7, cmake
8, flex
9, glib
10, json-glib
11, libxml2
12, appdirs
13, dbus-deviation
14, faust-cchardet
15, feedgen
16, lxml
17, networkx
18, pkgconfig
19, pyyaml
20, schema
21, setuptools
22, toposort
23, wheezy-template
24, libclang
25, gst_all_1
26}:
27
28buildPythonApplication rec {
29 pname = "hotdoc";
30 version = "0.13.7";
31
32 src = fetchPypi {
33 inherit pname version;
34 hash = "sha256-ESOmWeLJSXLDKBPsMBGR0zPbJHEqg/fj0G3VjUfPAJg=";
35 };
36
37 nativeBuildInputs = [
38 pkg-config
39 cmake
40 flex
41 ];
42
43 buildInputs = [
44 glib
45 json-glib
46 libxml2.dev
47 ];
48
49 propagatedBuildInputs = [
50 appdirs
51 dbus-deviation
52 faust-cchardet
53 feedgen
54 lxml
55 networkx
56 pkgconfig
57 pyyaml
58 schema
59 setuptools # for pkg_resources
60 toposort
61 wheezy-template
62 ];
63
64 nativeCheckInputs = [
65 pytestCheckHook
66 ];
67
68 # CMake is used to build CMARK, but the build system is still python
69 dontUseCmakeConfigure = true;
70
71 # Ensure C+GI+GST extensions are built and can be imported
72 pythonImportsCheck = [
73 "hotdoc.extensions.c.c_extension"
74 "hotdoc.extensions.gi.gi_extension"
75 "hotdoc.extensions.gst.gst_extension"
76 ];
77
78 # Run the tests by package instead of current dir
79 pytestFlagsArray = [ "--pyargs" "hotdoc" ];
80
81 disabledTests = [
82 # Test does not correctly handle path normalization for test comparison
83 "test_cli_overrides"
84 ] ++ lib.optionals stdenv.isDarwin [
85 # Test does not correctly handle absolute /home paths on Darwin (even fake ones)
86 "test_index"
87 ];
88
89 # Hardcode libclang paths
90 postPatch = ''
91 substituteInPlace hotdoc/extensions/c/c_extension.py \
92 --replace "shutil.which('llvm-config')" 'True' \
93 --replace "subprocess.check_output(['llvm-config', '--version']).strip().decode()" '"${libclang.version}"' \
94 --replace "subprocess.check_output(['llvm-config', '--prefix']).strip().decode()" '"${libclang.lib}"' \
95 --replace "subprocess.check_output(['llvm-config', '--libdir']).strip().decode()" '"${libclang.lib}/lib"'
96 '';
97
98 # Make pytest run from a temp dir to have it pick up installed package for cmark
99 preCheck = ''
100 pushd $TMPDIR
101 '';
102 postCheck = ''
103 popd
104 '';
105
106 passthru.tests = {
107 inherit (gst_all_1) gstreamer gst-plugins-base;
108 };
109
110 meta = with lib; {
111 description = "The tastiest API documentation system";
112 homepage = "https://hotdoc.github.io/";
113 license = [ licenses.lgpl21Plus ];
114 maintainers = with maintainers; [ lilyinstarlight ];
115 };
116}