python310Packages.pdf2docx: init at 0.5.6

authored by

happysalada and committed by
Yt
fddd11e0 9dfdbeb0

+72
+70
pkgs/development/python-modules/pdf2docx/default.nix
··· 1 + { stdenv 2 + , lib 3 + , fetchFromGitHub 4 + , python 5 + , buildPythonPackage 6 + , pythonRelaxDepsHook 7 + , imagemagick 8 + , pytestCheckHook 9 + , pymupdf 10 + , fire 11 + , fonttools 12 + , numpy 13 + , opencv4 14 + , tkinter 15 + , python-docx 16 + }: 17 + let 18 + version = "0.5.6"; 19 + in 20 + buildPythonPackage { 21 + pname = "pdf2docx"; 22 + inherit version; 23 + format = "setuptools"; 24 + 25 + src = fetchFromGitHub { 26 + owner = "dothinking"; 27 + repo = "pdf2docx"; 28 + rev = "v${version}"; 29 + hash = "sha256-NrT4GURQIJbqnHstfJrPzwLXT9c2oGBi4QJ6eGIFwu4="; 30 + }; 31 + 32 + nativeBuildInputs = [ pythonRelaxDepsHook imagemagick ]; 33 + pythonRemoveDeps = [ "opencv-python" ]; 34 + 35 + preBuild = "echo '${version}' > version.txt"; 36 + 37 + propagatedBuildInputs = [ 38 + tkinter 39 + pymupdf 40 + fire 41 + fonttools 42 + numpy 43 + opencv4 44 + python-docx 45 + ]; 46 + 47 + postInstall = lib.optionalString stdenv.isLinux '' 48 + # on linux the icon file can only be xbm format 49 + convert $out/${python.sitePackages}/pdf2docx/gui/icon.ico \ 50 + $out/${python.sitePackages}/pdf2docx/gui/icon.xbm 51 + substituteInPlace $out/${python.sitePackages}/pdf2docx/gui/App.py \ 52 + --replace 'icon.ico' 'icon.xbm' \ 53 + --replace 'iconbitmap(icon_path)' "iconbitmap(f'@{icon_path}')" 54 + ''; 55 + 56 + nativeCheckInputs = [ pytestCheckHook ]; 57 + 58 + pytestFlagsArray = [ "-v" "./test/test.py::TestConversion" ]; 59 + 60 + # Test fails due to "RuntimeError: cannot find builtin font with name 'Arial'": 61 + disabledTests = [ "test_unnamed_fonts" ]; 62 + 63 + meta = with lib; { 64 + description = "Convert PDF to DOCX"; 65 + homepage = "https://github.com/dothinking/pdf2docx"; 66 + changelog = "https://github.com/dothinking/pdf2docx/releases/tag/v${version}"; 67 + license = licenses.gpl3Only; 68 + maintainers = with maintainers; [ happysalada ]; 69 + }; 70 + }
+2
pkgs/top-level/python-packages.nix
··· 7816 7816 7817 7817 pdb2pqr = callPackage ../development/python-modules/pdb2pqr { }; 7818 7818 7819 + pdf2docx = callPackage ../development/python-modules/pdf2docx { }; 7820 + 7819 7821 pdf2image = callPackage ../development/python-modules/pdf2image { }; 7820 7822 7821 7823 pdfkit = callPackage ../development/python-modules/pdfkit { };