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 pytestFlags = [
51 "-v"
52 ];
53
54 enabledTestPaths = [
55 "./test/test.py::TestConversion"
56 ];
57 # Test fails due to "RuntimeError: cannot find builtin font with name 'Arial'":
58 disabledTests = [ "test_unnamed_fonts" ];
59
60 meta = with lib; {
61 description = "Convert PDF to DOCX";
62 mainProgram = "pdf2docx";
63 homepage = "https://github.com/ArtifexSoftware/pdf2docx";
64 changelog = "https://github.com/ArtifexSoftware/pdf2docx/releases/tag/v${version}";
65 license = licenses.agpl3Only;
66 maintainers = with maintainers; [ happysalada ];
67 };
68}