nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 155 lines 3.7 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonApplication, 5 fetchpatch, 6 fetchPypi, 7 replaceVars, 8 clang, 9 libclang, 10 pytestCheckHook, 11 pkg-config, 12 cmake, 13 flex, 14 glib, 15 json-glib, 16 libxml2, 17 appdirs, 18 backports-entry-points-selectable, 19 dbus-deviation, 20 faust-cchardet, 21 feedgen, 22 lxml, 23 networkx, 24 pkgconfig, 25 pyyaml, 26 schema, 27 setuptools, 28 toposort, 29 wheezy-template, 30 llvmPackages, 31 gst_all_1, 32}: 33 34buildPythonApplication rec { 35 pname = "hotdoc"; 36 version = "0.17.4"; 37 pyproject = true; 38 39 src = fetchPypi { 40 inherit pname version; 41 hash = "sha256-xNXf9kfwOqh6HS0GA10oGe3QmbkWNeOy7jkIKTV66fw="; 42 }; 43 44 patches = [ 45 (replaceVars ./clang.patch { 46 clang = lib.getExe clang; 47 libclang = "${lib.getLib libclang}/lib/libclang${stdenv.hostPlatform.extensions.sharedLibrary}"; 48 }) 49 50 # Fix build with gcc15 51 (fetchpatch { 52 name = "hotdoc-fix-c_comment_scanner-function-prototypes-gcc15.patch"; 53 url = "https://github.com/hotdoc/hotdoc/commit/adf8518431fafb78c9b47862a0a9a58824b6a421.patch"; 54 hash = "sha256-5y50Yk+AjV3aSk8H3k9od/Yvy09FyQQOcVOAcstQnw8="; 55 }) 56 ]; 57 58 build-system = [ setuptools ]; 59 60 nativeBuildInputs = [ 61 pkg-config 62 cmake 63 flex 64 ]; 65 66 buildInputs = [ 67 glib 68 json-glib 69 libxml2.dev 70 ]; 71 72 dependencies = [ 73 appdirs 74 backports-entry-points-selectable 75 dbus-deviation 76 faust-cchardet 77 feedgen 78 lxml 79 networkx 80 pkgconfig 81 pyyaml 82 schema 83 setuptools # for pkg_resources 84 toposort 85 wheezy-template 86 ]; 87 88 nativeCheckInputs = [ pytestCheckHook ]; 89 90 # CMake is used to build CMARK, but the build system is still python 91 dontUseCmakeConfigure = true; 92 93 # Ensure C+GI+GST extensions are built and can be imported 94 pythonImportsCheck = [ 95 "hotdoc.extensions.c.c_extension" 96 "hotdoc.extensions.gi.gi_extension" 97 "hotdoc.extensions.gst.gst_extension" 98 ]; 99 100 pytestFlags = [ 101 # Run the tests by package instead of current dir 102 "--pyargs" 103 "hotdoc" 104 ]; 105 106 disabledTestPaths = [ 107 # Executing hotdoc exits with code 1 108 "tests/test_hotdoc.py::TestHotdoc::test_basic" 109 "tests/test_hotdoc.py::TestHotdoc::test_explicit_conf_file" 110 "tests/test_hotdoc.py::TestHotdoc::test_implicit_conf_file" 111 "tests/test_hotdoc.py::TestHotdoc::test_private_folder" 112 ]; 113 114 disabledTests = [ 115 # Test does not correctly handle path normalization for test comparison 116 "test_cli_overrides" 117 ] 118 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 119 # Test does not correctly handle absolute /home paths on Darwin (even fake ones) 120 "test_index" 121 ]; 122 123 postPatch = 124 # Hardcode libclang paths 125 '' 126 substituteInPlace hotdoc/extensions/c/c_extension.py \ 127 --replace "shutil.which('llvm-config')" 'True' \ 128 --replace "subprocess.check_output(['llvm-config', '--version']).strip().decode()" '"${lib.versions.major llvmPackages.libclang.version}"' \ 129 --replace "subprocess.check_output(['llvm-config', '--prefix']).strip().decode()" '"${lib.getLib llvmPackages.libclang}"' \ 130 --replace "subprocess.check_output(['llvm-config', '--libdir']).strip().decode()" '"${lib.getLib llvmPackages.libclang}/lib"' 131 '' 132 # <https://github.com/MathieuDuponchelle/cmark/pull/2> 133 + '' 134 patch -p1 -d cmark -i ${./fix-cmake-4.patch} 135 ''; 136 137 # Make pytest run from a temp dir to have it pick up installed package for cmark 138 preCheck = '' 139 pushd $TMPDIR 140 ''; 141 postCheck = '' 142 popd 143 ''; 144 145 passthru.tests = { 146 inherit (gst_all_1) gstreamer gst-plugins-base; 147 }; 148 149 meta = { 150 description = "Tastiest API documentation system"; 151 homepage = "https://hotdoc.github.io/"; 152 license = [ lib.licenses.lgpl21Plus ]; 153 maintainers = [ ]; 154 }; 155}