2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
2024-09-19 14:19:46 +00:00
|
|
|
fetchpatch2,
|
2024-06-05 15:53:02 +00:00
|
|
|
cryptography,
|
|
|
|
charset-normalizer,
|
|
|
|
pythonOlder,
|
|
|
|
pytestCheckHook,
|
|
|
|
setuptools,
|
|
|
|
substituteAll,
|
|
|
|
ocrmypdf,
|
2022-05-18 14:49:53 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
2022-06-16 17:23:12 +00:00
|
|
|
pname = "pdfminer-six";
|
2024-07-27 06:49:29 +00:00
|
|
|
version = "20240706";
|
2024-01-02 11:29:13 +00:00
|
|
|
pyproject = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
disabled = pythonOlder "3.8";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "pdfminer";
|
|
|
|
repo = "pdfminer.six";
|
2024-07-27 06:49:29 +00:00
|
|
|
rev = "refs/tags/${version}";
|
|
|
|
hash = "sha256-aY7GQADRxeiclr6/G3RRgrPcl8rGiC85JYEIjIa+vG0=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
patches = [
|
2024-09-19 14:19:46 +00:00
|
|
|
# https://github.com/pdfminer/pdfminer.six/pull/1027
|
|
|
|
(fetchpatch2 {
|
|
|
|
name = "fix-dereference-MediaBox.patch";
|
|
|
|
url = "https://github.com/pdfminer/pdfminer.six/pull/1027/commits/ad101c152c71431a21bfa5a8dbe33b3ba385ceec.patch?full_index=1";
|
|
|
|
excludes = [ "CHANGELOG.md" ];
|
|
|
|
hash = "sha256-fsSXvN92MVtNFpAst0ctvGrbxVvoe4Nyz4wMZqJ1aw8=";
|
|
|
|
})
|
2024-01-02 11:29:13 +00:00
|
|
|
(substituteAll {
|
|
|
|
src = ./disable-setuptools-git-versioning.patch;
|
|
|
|
inherit version;
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
build-system = [ setuptools ];
|
2024-01-02 11:29:13 +00:00
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
dependencies = [
|
|
|
|
charset-normalizer
|
|
|
|
cryptography
|
|
|
|
];
|
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-11-04 12:27:35 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"pdfminer"
|
|
|
|
"pdfminer.high_level"
|
|
|
|
];
|
2022-05-18 14:49:53 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeCheckInputs = [ pytestCheckHook ];
|
2022-03-30 09:31:56 +00:00
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
disabledTests = [
|
|
|
|
# The binary file samples/contrib/issue-1004-indirect-mediabox.pdf is
|
|
|
|
# stripped from fix-dereference-MediaBox.patch.
|
|
|
|
"test_contrib_issue_1004_mediabox"
|
|
|
|
];
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
passthru = {
|
|
|
|
tests = {
|
|
|
|
inherit ocrmypdf;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2024-07-27 06:49:29 +00:00
|
|
|
changelog = "https://github.com/pdfminer/pdfminer.six/blob/${src.rev}/CHANGELOG.md";
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "PDF parser and analyzer";
|
|
|
|
homepage = "https://github.com/pdfminer/pdfminer.six";
|
|
|
|
license = licenses.mit;
|
2024-05-15 15:35:15 +00:00
|
|
|
maintainers = with maintainers; [ psyanticy ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|