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