Commit 8f94e4b5 authored by Ihar Hrachyshka's avatar Ihar Hrachyshka
Browse files

python312Packages.pdfplumber: fix dependencies



The version depends on pypdfium2, not wand. Now that pypdfium2 is
packaged for nixpkgs, this patch updates to pull it. We can now execute
their test suite too.

Signed-off-by: default avatarIhar Hrachyshka <ihar.hrachyshka@gmail.com>
parent 423d6f01
Loading
Loading
Loading
Loading
+11 −26
Original line number Diff line number Diff line
@@ -9,11 +9,11 @@
  pandas-stubs,
  pdfminer-six,
  pillow,
  pypdfium2,
  pytest-cov,
  pytest-parallel,
  pytestCheckHook,
  pythonOlder,
  types-pillow,
  wand,
}:

buildPythonPackage rec {
@@ -21,8 +21,6 @@ buildPythonPackage rec {
  version = "0.11.5";
  format = "setuptools";

  disabled = pythonOlder "3.7";

  src = fetchFromGitHub {
    owner = "jsvine";
    repo = "pdfplumber";
@@ -30,19 +28,17 @@ buildPythonPackage rec {
    hash = "sha256-oe6lZyQKXASzG7Ho6o7mlXY+BOgVBaACebxbYD+1+x0=";
  };

  postPatch = ''
    substituteInPlace setup.cfg \
      --replace "--cov=pdfplumber --cov-report xml:coverage.xml --cov-report term" ""
  '';

  propagatedBuildInputs = [
  dependencies = [
    pdfminer-six
    pillow
    wand
    pypdfium2
  ];

  preCheck = ''
    export HOME=$(mktemp -d)
    # test_issue_1089 assumes the soft limit on open files is "low", otherwise it never completes
    # reported at: https://github.com/jsvine/pdfplumber/issues/1263
    ulimit -n 1024
  '';

  nativeCheckInputs = [
@@ -51,6 +47,7 @@ buildPythonPackage rec {
    nbexec
    pandas
    pandas-stubs
    pytest-cov
    pytest-parallel
    pytestCheckHook
    types-pillow
@@ -58,24 +55,12 @@ buildPythonPackage rec {

  pythonImportsCheck = [ "pdfplumber" ];

  disabledTests = [
    # flaky
    "test__repr_png_"
  ];

  disabledTestPaths = [
    # Tests requires pypdfium2
    "tests/test_display.py"
    # Tests requires pypdfium2
    "tests/test_issues.py"
  ];

  meta = with lib; {
  meta = {
    description = "Plumb a PDF for detailed information about each char, rectangle, line, et cetera — and easily extract text and tables";
    mainProgram = "pdfplumber";
    homepage = "https://github.com/jsvine/pdfplumber";
    changelog = "https://github.com/jsvine/pdfplumber/releases/tag/v${version}";
    license = licenses.mit;
    maintainers = with maintainers; [ happysalada ];
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ happysalada ];
  };
}