nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, isPy3k
5, cryptography
6, charset-normalizer
7, pytestCheckHook
8, ocrmypdf
9}:
10
11buildPythonPackage rec {
12 pname = "pdfminer_six";
13 version = "20220506";
14
15 disabled = !isPy3k;
16
17 src = fetchFromGitHub {
18 owner = "pdfminer";
19 repo = "pdfminer.six";
20 rev = version;
21 sha256 = "sha256-Lq+ou7+Lmr1H69L8X/vuky+/tXDD3bBBaCysymeRuXA=";
22 };
23
24 propagatedBuildInputs = [ charset-normalizer cryptography ];
25
26 postInstall = ''
27 for file in $out/bin/*.py; do
28 ln $file ''${file//.py/}
29 done
30 '';
31
32 postPatch = ''
33 # Verion is not stored in repo, gets added by a GitHub action after tag is created
34 # https://github.com/pdfminer/pdfminer.six/pull/727
35 substituteInPlace pdfminer/__init__.py --replace "__VERSION__" ${version}
36 '';
37
38 pythonImportsCheck = [ "pdfminer" ];
39
40 checkInputs = [ pytestCheckHook ];
41
42 passthru = {
43 tests = {
44 inherit ocrmypdf;
45 };
46 };
47
48 meta = with lib; {
49 description = "PDF parser and analyzer";
50 homepage = "https://github.com/pdfminer/pdfminer.six";
51 license = licenses.mit;
52 maintainers = with maintainers; [ psyanticy marsam ];
53 };
54}