python310Packages.pdf2docx: init at 0.5.6
This commit is contained in:
parent
9dfdbeb0fa
commit
fddd11e002
70
pkgs/development/python-modules/pdf2docx/default.nix
Normal file
70
pkgs/development/python-modules/pdf2docx/default.nix
Normal file
|
@ -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 ];
|
||||
};
|
||||
}
|
|
@ -7816,6 +7816,8 @@ self: super: with self; {
|
|||
|
||||
pdb2pqr = callPackage ../development/python-modules/pdb2pqr { };
|
||||
|
||||
pdf2docx = callPackage ../development/python-modules/pdf2docx { };
|
||||
|
||||
pdf2image = callPackage ../development/python-modules/pdf2image { };
|
||||
|
||||
pdfkit = callPackage ../development/python-modules/pdfkit { };
|
||||
|
|
Loading…
Reference in a new issue