diff options
author | Alyssa Ross <hi@alyssa.is> | 2023-08-26 09:19:25 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2023-08-26 09:19:25 +0000 |
commit | 55abc327b49b4097e48c916e40803caa8cf46e8f (patch) | |
tree | 1c0420ab3fb21d9485460b912f1c3eae18781871 /nixpkgs/pkgs/development/python-modules/pdf2docx | |
parent | 7936cf821dccc1eaade44b852db09d03fae8e5f3 (diff) | |
parent | 18324978d632ffc55ef1d928e81630c620f4f447 (diff) | |
download | nixlib-55abc327b49b4097e48c916e40803caa8cf46e8f.tar nixlib-55abc327b49b4097e48c916e40803caa8cf46e8f.tar.gz nixlib-55abc327b49b4097e48c916e40803caa8cf46e8f.tar.bz2 nixlib-55abc327b49b4097e48c916e40803caa8cf46e8f.tar.lz nixlib-55abc327b49b4097e48c916e40803caa8cf46e8f.tar.xz nixlib-55abc327b49b4097e48c916e40803caa8cf46e8f.tar.zst nixlib-55abc327b49b4097e48c916e40803caa8cf46e8f.zip |
Merge branch 'nixos-unstable' of https://github.com/NixOS/nixpkgs
Conflicts: nixpkgs/pkgs/build-support/go/module.nix
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/pdf2docx')
-rw-r--r-- | nixpkgs/pkgs/development/python-modules/pdf2docx/default.nix | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/pdf2docx/default.nix b/nixpkgs/pkgs/development/python-modules/pdf2docx/default.nix new file mode 100644 index 000000000000..fc9987d3e903 --- /dev/null +++ b/nixpkgs/pkgs/development/python-modules/pdf2docx/default.nix @@ -0,0 +1,70 @@ +{ stdenv +, lib +, fetchFromGitHub +, python +, buildPythonPackage +, pythonRelaxDepsHook +, imagemagick +, pytestCheckHook +, pymupdf +, fire +, fonttools +, numpy +, opencv4 +, tkinter +, python-docx +}: +let + version = "0.5.6"; +in +buildPythonPackage { + pname = "pdf2docx"; + inherit version; + format = "setuptools"; + + src = fetchFromGitHub { + owner = "dothinking"; + repo = "pdf2docx"; + rev = "v${version}"; + hash = "sha256-NrT4GURQIJbqnHstfJrPzwLXT9c2oGBi4QJ6eGIFwu4="; + }; + + nativeBuildInputs = [ pythonRelaxDepsHook imagemagick ]; + pythonRemoveDeps = [ "opencv-python" ]; + + preBuild = "echo '${version}' > version.txt"; + + propagatedBuildInputs = [ + tkinter + pymupdf + fire + fonttools + numpy + opencv4 + python-docx + ]; + + postInstall = lib.optionalString stdenv.isLinux '' + # on linux the icon file can only be xbm format + convert $out/${python.sitePackages}/pdf2docx/gui/icon.ico \ + $out/${python.sitePackages}/pdf2docx/gui/icon.xbm + substituteInPlace $out/${python.sitePackages}/pdf2docx/gui/App.py \ + --replace 'icon.ico' 'icon.xbm' \ + --replace 'iconbitmap(icon_path)' "iconbitmap(f'@{icon_path}')" + ''; + + nativeCheckInputs = [ pytestCheckHook ]; + + pytestFlagsArray = [ "-v" "./test/test.py::TestConversion" ]; + + # Test fails due to "RuntimeError: cannot find builtin font with name 'Arial'": + disabledTests = [ "test_unnamed_fonts" ]; + + meta = with lib; { + description = "Convert PDF to DOCX"; + homepage = "https://github.com/dothinking/pdf2docx"; + changelog = "https://github.com/dothinking/pdf2docx/releases/tag/v${version}"; + license = licenses.gpl3Only; + maintainers = with maintainers; [ happysalada ]; + }; +} |