diff --git a/pkg.info b/pkg.info index d41d37c..6f69bb6 100644 --- a/pkg.info +++ b/pkg.info @@ -1,9 +1,23 @@ name: python-pdftotext description: Simple PDF text extraction version: 3.0.0 +revision: 2 url: https://github.com/jalan/pdftotext license: MIT +maintainers: + - enumdev@enumerated.dev architecture: any -depends: ["poppler","python3"] -make_depends: ["python-build","python-installer","python-setuptools","python-wheel"] type: source +depends: + - poppler + - python3=3.14.* +make_depends: + - python-build + - python-installer + - python-setuptools + - python-wheel +downloads: + - url: https://github.com/jalan/pdftotext/archive/refs/tags/v${BPM_PKG_VERSION}.tar.gz + extract_to: ${BPM_SOURCE} + extract_strip_components: 1 + checksum: eb201239b19b9e4337da6a1a1e6c9fca1da4e66fbbaa3b59f3b1a48278654a64 diff --git a/source-files/stop_using_deprecated_pkg_resources.patch b/source-files/stop_using_deprecated_pkg_resources.patch new file mode 100644 index 0000000..c9ecd81 --- /dev/null +++ b/source-files/stop_using_deprecated_pkg_resources.patch @@ -0,0 +1,50 @@ +From a48f24f5fdbe3877e13ebca66ed002cabb4b5968 Mon Sep 17 00:00:00 2001 +From: Jason Alan Palmer +Date: Sun, 9 Feb 2025 17:06:31 -0700 +Subject: [PATCH] Stop using the deprecated pkg_resources + +--- + tests/test_pdftotext.py | 24 +++++------------------- + 1 file changed, 5 insertions(+), 19 deletions(-) + +diff --git a/tests/test_pdftotext.py b/tests/test_pdftotext.py +index 66c994d..8f329d1 100644 +--- a/tests/test_pdftotext.py ++++ b/tests/test_pdftotext.py +@@ -1,31 +1,17 @@ + """Tests for the pdftotext module.""" + ++import importlib.resources + import io +-import pkg_resources + import unittest + + import pdftotext + + +-file_names = [ +- "abcde.pdf", +- "blank.pdf", +- "both_passwords.pdf", +- "corrupt.pdf", +- "corrupt_page.pdf", +- "landscape_0.pdf", +- "landscape_90.pdf", +- "portrait.pdf", +- "table.pdf", +- "three_columns.pdf", +- "two_pages.pdf", +- "user_password.pdf", +-] + test_files = {} +-for file_name in file_names: +- file_path = pkg_resources.resource_filename("tests", file_name) +- with open(file_path, "rb") as open_file: +- test_files[file_name] = io.BytesIO(open_file.read()) ++directory = importlib.resources.files("tests") ++for f in directory.iterdir(): ++ if f.name.endswith(".pdf"): ++ test_files[f.name] = io.BytesIO(f.read_bytes()) + + + def get_file(name): diff --git a/source.sh b/source.sh index 89f8659..fa9f3c3 100644 --- a/source.sh +++ b/source.sh @@ -2,14 +2,11 @@ # BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE # BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT -DOWNLOAD="https://github.com/jalan/pdftotext/archive/refs/tags/v${BPM_PKG_VERSION}.tar.gz" -FILENAME="${DOWNLOAD##*/}" - # The prepare function is executed in the root of the temp directory -# This function is used for downloading files and putting them into the correct location +# This function is used for putting downloaded files to the correct location or applying patches prepare() { - wget "$DOWNLOAD" - tar -xvf "$FILENAME" --strip-components=1 -C "$BPM_SOURCE" + cd "$BPM_SOURCE" + patch -Np1 -i "$BPM_WORKDIR"/stop_using_deprecated_pkg_resources.patch } # The build function is executed in the source directory