2022-05-18 14:49:53 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, isPy3k
|
|
|
|
, cryptography
|
|
|
|
, charset-normalizer
|
2022-11-04 12:27:35 +00:00
|
|
|
, pythonOlder
|
|
|
|
, typing-extensions
|
2022-05-18 14:49:53 +00:00
|
|
|
, pytestCheckHook
|
|
|
|
, ocrmypdf
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
2022-06-16 17:23:12 +00:00
|
|
|
pname = "pdfminer-six";
|
2022-11-04 12:27:35 +00:00
|
|
|
version = "20221105";
|
|
|
|
format = "setuptools";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
disabled = !isPy3k;
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "pdfminer";
|
|
|
|
repo = "pdfminer.six";
|
|
|
|
rev = version;
|
2022-11-04 12:27:35 +00:00
|
|
|
sha256 = "sha256-OyEeQBuYfj4iEcRt2/daSaUfTOjCVSCyHW2qffal+Bk=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-11-04 12:27:35 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
charset-normalizer
|
|
|
|
cryptography
|
|
|
|
] ++ lib.optionals (pythonOlder "3.8") [ typing-extensions ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-10-28 06:52:43 +00:00
|
|
|
postInstall = ''
|
|
|
|
for file in $out/bin/*.py; do
|
|
|
|
ln $file ''${file//.py/}
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
postPatch = ''
|
2022-11-04 12:27:35 +00:00
|
|
|
# Version is not stored in repo, gets added by a GitHub action after tag is created
|
2022-03-30 09:31:56 +00:00
|
|
|
# https://github.com/pdfminer/pdfminer.six/pull/727
|
|
|
|
substituteInPlace pdfminer/__init__.py --replace "__VERSION__" ${version}
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2022-11-04 12:27:35 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"pdfminer"
|
|
|
|
"pdfminer.high_level"
|
|
|
|
];
|
2022-05-18 14:49:53 +00:00
|
|
|
|
2022-11-04 12:27:35 +00:00
|
|
|
checkInputs = [
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
2022-03-30 09:31:56 +00:00
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
passthru = {
|
|
|
|
tests = {
|
|
|
|
inherit ocrmypdf;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "PDF parser and analyzer";
|
|
|
|
homepage = "https://github.com/pdfminer/pdfminer.six";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ psyanticy marsam ];
|
|
|
|
};
|
|
|
|
}
|