1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 cryptography,
6 charset-normalizer,
7 pythonOlder,
8 pytestCheckHook,
9 setuptools,
10 substituteAll,
11 ocrmypdf,
12}:
13
14buildPythonPackage rec {
15 pname = "pdfminer-six";
16 version = "20240706";
17 pyproject = true;
18
19 disabled = pythonOlder "3.8";
20
21 src = fetchFromGitHub {
22 owner = "pdfminer";
23 repo = "pdfminer.six";
24 rev = "refs/tags/${version}";
25 hash = "sha256-aY7GQADRxeiclr6/G3RRgrPcl8rGiC85JYEIjIa+vG0=";
26 };
27
28 patches = [
29 (substituteAll {
30 src = ./disable-setuptools-git-versioning.patch;
31 inherit version;
32 })
33 ];
34
35 build-system = [ setuptools ];
36
37 dependencies = [
38 charset-normalizer
39 cryptography
40 ];
41
42 postInstall = ''
43 for file in $out/bin/*.py; do
44 ln $file ''${file//.py/}
45 done
46 '';
47
48 pythonImportsCheck = [
49 "pdfminer"
50 "pdfminer.high_level"
51 ];
52
53 nativeCheckInputs = [ pytestCheckHook ];
54
55 passthru = {
56 tests = {
57 inherit ocrmypdf;
58 };
59 };
60
61 meta = with lib; {
62 changelog = "https://github.com/pdfminer/pdfminer.six/blob/${src.rev}/CHANGELOG.md";
63 description = "PDF parser and analyzer";
64 homepage = "https://github.com/pdfminer/pdfminer.six";
65 license = licenses.mit;
66 maintainers = with maintainers; [ psyanticy ];
67 };
68}