32 # PyMuPDF needs the C++ bindings generated
33 mupdf-cxx = mupdf.override {
39 in buildPythonPackage rec {
44 disabled = pythonOlder "3.7";
46 src = fetchFromGitHub {
49 rev = "refs/tags/${version}";
50 hash = "sha256-m2zq04+PDnlzFuqeSt27UhdHXTHxpHdMPIg5RQl/5bQ=";
53 # swig is not wrapped as Python package
54 # libclang calls itself just clang in wheel metadata
56 substituteInPlace pyproject.toml \
57 --replace-fail '"swig",' "" \
58 --replace-fail "libclang" "clang"
75 ] ++ lib.optionals (stdenv.system == "x86_64-darwin") [
79 propagatedBuildInputs = [
84 # force using system MuPDF (must be defined in environment and empty)
85 PYMUPDF_SETUP_MUPDF_BUILD = "";
87 PYMUPDF_MUPDF_LIB = "${lib.getLib mupdf-cxx}/lib";
88 PYMUPDF_MUPDF_INCLUDE = "${lib.getDev mupdf-cxx}/include";
91 # TODO: manually add mupdf rpath until upstream fixes it
92 postInstall = lib.optionalString stdenv.isDarwin ''
93 for lib in */*.so $out/${python.sitePackages}/*/*.so; do
94 install_name_tool -add_rpath ${lib.getLib mupdf-cxx}/lib "$lib"
104 export PATH="$PATH:$out/bin";
108 # fails for indeterminate reasons
118 "test_fz_write_pixmap_as_jpeg"
119 # NotImplementedError
148 "test_page_links_generator"
151 "test_techwriter_append"
153 # Issue with FzArchive
158 "test_write_stabilized_with_links"
161 # Fonts not available
166 ] ++ lib.optionals stdenv.isDarwin [
167 # darwin does not support OCR right now
171 disabledTestPaths = [
172 # Issue with FzArchive
173 "tests/test_docs_samples.py"
176 pythonImportsCheck = [
182 description = "Python bindings for MuPDF's rendering library";
183 homepage = "https://github.com/pymupdf/PyMuPDF";
184 changelog = "https://github.com/pymupdf/PyMuPDF/releases/tag/${version}";
185 license = licenses.agpl3Only;
186 maintainers = with maintainers; [ teto ];
187 platforms = platforms.unix;