Merge pull request #112411 from fabaff/license-ocrmypdf

ocrmypdf: 11.3.3 -> 11.6.0
This commit is contained in:
Sandro 2021-02-08 20:45:37 +01:00 committed by GitHub
commit c6ba81f02e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 59 deletions

View File

@ -1,52 +0,0 @@
From 4315b58e0bffedd145cec61f96062292cd98278e Mon Sep 17 00:00:00 2001
From: Pascal Bach <pascal.bach@nextrem.ch>
Date: Thu, 23 Jul 2020 21:37:33 +0200
Subject: [PATCH] Make compatible with pdfminer.six version 20200720
---
setup.py | 2 +-
src/ocrmypdf/pdfinfo/layout.py | 8 ++++++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/setup.py b/setup.py
index bd95ed9..d1f4ab1 100644
--- a/setup.py
+++ b/setup.py
@@ -83,7 +83,7 @@ setup(
'cffi >= 1.9.1', # must be a setup and install requirement
'coloredlogs >= 14.0', # strictly optional
'img2pdf >= 0.3.0, < 0.4', # pure Python, so track HEAD closely
- 'pdfminer.six >= 20191110, <= 20200517',
+ 'pdfminer.six >= 20191110, <= 20200720',
'pikepdf >= 1.14.0, < 2',
'Pillow >= 7.0.0',
'pluggy >= 0.13.0',
diff --git a/src/ocrmypdf/pdfinfo/layout.py b/src/ocrmypdf/pdfinfo/layout.py
index 98bd82e..8b41e14 100644
--- a/src/ocrmypdf/pdfinfo/layout.py
+++ b/src/ocrmypdf/pdfinfo/layout.py
@@ -26,7 +26,11 @@ import pdfminer.pdfdevice
import pdfminer.pdfinterp
from pdfminer.converter import PDFLayoutAnalyzer
from pdfminer.layout import LAParams, LTChar, LTPage, LTTextBox
-from pdfminer.pdfdocument import PDFTextExtractionNotAllowed
+try:
+ from pdfminer.pdfdocument import PDFTextExtractionNotAllowedError
+except ImportError:
+ # Fallback for pdfminer < 20200720
+ from pdfminer.pdfdocument import PDFTextExtractionNotAllowed as PDFTextExtractionNotAllowedError
from pdfminer.pdffont import PDFSimpleFont, PDFUnicodeNotDefined
from pdfminer.pdfpage import PDFPage
from pdfminer.utils import bbox2str, matrix2str
@@ -239,7 +243,7 @@ def get_page_analysis(infile, pageno, pscript5_mode):
with Path(infile).open('rb') as f:
page = PDFPage.get_pages(f, pagenos=[pageno], maxpages=0)
interp.process_page(next(page))
- except PDFTextExtractionNotAllowed:
+ except PDFTextExtractionNotAllowedError:
raise EncryptedPdfError()
finally:
if pscript5_mode:
--
2.27.0

View File

@ -7,7 +7,8 @@
, python3 , python3
, python3Packages , python3Packages
, qpdf , qpdf
, lib, stdenv , lib
, stdenv
, tesseract4 , tesseract4
, unpaper , unpaper
, substituteAll , substituteAll
@ -29,18 +30,17 @@ let
in in
buildPythonApplication rec { buildPythonApplication rec {
pname = "ocrmypdf"; pname = "ocrmypdf";
version = "11.3.3"; version = "11.6.0";
disabled = ! python3Packages.isPy3k; disabled = ! python3Packages.isPy3k;
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "jbarlow83"; owner = "jbarlow83";
repo = "OCRmyPDF"; repo = "OCRmyPDF";
rev = "v${version}"; rev = "v${version}";
sha256 = "0qv34clid65p11dgqalyk7b7myn5ibiz8i9xxhxkmjblw297p6ak"; sha256 = "0inmmpam0vcm5n4sm6lh9p5swk44clknvm1cdwk9cax01mdqljza";
}; };
nativeBuildInputs = with python3Packages; [ nativeBuildInputs = with python3Packages; [
pytestrunner
setuptools setuptools
setuptools-scm-git-archive setuptools-scm-git-archive
setuptools_scm setuptools_scm
@ -65,8 +65,7 @@ buildPythonApplication rec {
pytest pytest
pytest-helpers-namespace pytest-helpers-namespace
pytest_xdist pytest_xdist
pytestcov pytest-cov
pytestrunner
python-xmp-toolkit python-xmp-toolkit
pytestCheckHook pytestCheckHook
] ++ runtimeDeps; ] ++ runtimeDeps;
@ -83,7 +82,7 @@ buildPythonApplication rec {
meta = with lib; { meta = with lib; {
homepage = "https://github.com/jbarlow83/OCRmyPDF"; homepage = "https://github.com/jbarlow83/OCRmyPDF";
description = "Adds an OCR text layer to scanned PDF files, allowing them to be searched"; description = "Adds an OCR text layer to scanned PDF files, allowing them to be searched";
license = licenses.gpl3; license = with licenses; [ mpl20 mit ];
platforms = platforms.linux; platforms = platforms.linux;
maintainers = [ maintainers.kiwi ]; maintainers = [ maintainers.kiwi ];
}; };