1{ 2 stdenv, 3 lib, 4 fetchFromGitHub, 5 buildPythonPackage, 6 pip, 7 pytestCheckHook, 8 pymupdf, 9 fire, 10 fonttools, 11 numpy, 12 opencv-python-headless, 13 tkinter, 14 python-docx, 15 setuptools, 16}: 17let 18 version = "0.5.8"; 19in 20buildPythonPackage { 21 pname = "pdf2docx"; 22 inherit version; 23 pyproject = true; 24 25 src = fetchFromGitHub { 26 owner = "ArtifexSoftware"; 27 repo = "pdf2docx"; 28 tag = "v${version}"; 29 hash = "sha256-tMITDm2NkxWS+H/hhd2LlaPbyuI86ZKaALqqHJqb8V0="; 30 }; 31 32 build-system = [ 33 pip 34 setuptools 35 ]; 36 37 preBuild = "echo '${version}' > version.txt"; 38 39 dependencies = [ 40 pymupdf 41 fire 42 fonttools 43 numpy 44 opencv-python-headless 45 python-docx 46 ]; 47 48 nativeCheckInputs = [ pytestCheckHook ]; 49 50 pytestFlagsArray = [ 51 "-v" 52 "./test/test.py::TestConversion" 53 ]; 54 55 # Test fails due to "RuntimeError: cannot find builtin font with name 'Arial'": 56 disabledTests = [ "test_unnamed_fonts" ]; 57 58 meta = with lib; { 59 description = "Convert PDF to DOCX"; 60 mainProgram = "pdf2docx"; 61 homepage = "https://github.com/ArtifexSoftware/pdf2docx"; 62 changelog = "https://github.com/ArtifexSoftware/pdf2docx/releases/tag/v${version}"; 63 license = licenses.agpl3Only; 64 maintainers = with maintainers; [ happysalada ]; 65 }; 66}