about summary refs log tree commit diff
path: root/pkgs/development/python-modules/pdfx/default.nix
blob: c8759c4601fea84ed76147c1724fdc1bf52ad1cd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  pdfminer-six,
  chardet,
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "pdfx";
  version = "1.4.1";
  format = "setuptools";

  src = fetchFromGitHub {
    owner = "metachris";
    repo = "pdfx";
    rev = "v${version}";
    hash = "sha256-POpP6XwcqwvImrtIiDjpnHoNE0MKapuPjxojo+ocBK0=";
  };

  postPatch = ''
    substituteInPlace requirements.txt \
      --replace "chardet==4.0.0" "chardet" \
      --replace "pdfminer.six==20201018" "pdfminer.six"
  '';

  propagatedBuildInputs = [
    pdfminer-six
    chardet
  ];

  nativeCheckInputs = [ pytestCheckHook ];

  meta = with lib; {
    inherit (src.meta) homepage;
    description = "Extract references (pdf, url, doi, arxiv) and metadata from a PDF";
    mainProgram = "pdfx";
    license = licenses.asl20;
    maintainers = [ ];
  };
}