about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/scancode-toolkit/default.nix
blob: fa7dabc2729333cad6c430283e6c8756a0896e5f (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
{ lib
, fetchPypi
, buildPythonPackage
, isPy3k
, markupsafe
, click
, typecode
, gemfileparser
, pefile
, fingerprints
, spdx-tools
, fasteners
, pycryptodome
, urlpy
, dparse
, jaraco_functools
, pkginfo
, debian-inspector
, extractcode
, ftfy
, pyahocorasick
, colorama
, jsonstreams
, packageurl-python
, pymaven-patch
, nltk
, pygments
, bitarray
, jinja2
, javaproperties
, boolean-py
, license-expression
, extractcode-7z
, extractcode-libarchive
, typecode-libmagic
, pytestCheckHook
}:
buildPythonPackage rec {
  pname = "scancode-toolkit";
  version = "21.6.7";
  disabled = !isPy3k;

  src = fetchPypi {
    inherit pname version;
    sha256 = "056923ce556cd6d402e5cc98567cb0331a1b6349d03ec565f8ce1c9c37f3a783";
  };

  dontConfigure = true;

  # https://github.com/nexB/scancode-toolkit/issues/2501
  # * dparse2 is a "Temp fork for Python 2 support", but pdfminer requires
  # Python 3, so it's "fine" to leave dparse2 unpackaged and use the "normal"
  # version
  # * ftfy was pinned for similar reasons (to support Python 2), but rather than
  # packaging an older version, I figured it would be better to remove the
  # erroneous (at least for our usage) version bound
  # * bitarray's version bound appears to be unnecessary for similar reasons
  postPatch = ''
    substituteInPlace setup.cfg \
      --replace "dparse2" "dparse" \
      --replace "ftfy <  5.0.0" "ftfy" \
      --replace "bitarray >= 0.8.1, < 1.0.0" "bitarray"
  '';

  propagatedBuildInputs = [
    markupsafe
    click
    typecode
    gemfileparser
    pefile
    fingerprints
    spdx-tools
    fasteners
    pycryptodome
    urlpy
    dparse
    jaraco_functools
    pkginfo
    debian-inspector
    extractcode
    ftfy
    pyahocorasick
    colorama
    jsonstreams
    packageurl-python
    pymaven-patch
    nltk
    pygments
    bitarray
    jinja2
    javaproperties
    boolean-py
    license-expression
    extractcode-7z
    extractcode-libarchive
    typecode-libmagic
  ];

  checkInputs = [
    pytestCheckHook
  ];

  # Importing scancode needs a writeable home, and preCheck happens in between
  # pythonImportsCheckPhase and pytestCheckPhase.
  postInstall = ''
    export HOME=$(mktemp -d)
  '';

  pythonImportsCheck = [
    "scancode"
  ];

  # takes a long time and doesn't appear to do anything
  dontStrip = true;

  meta = with lib; {
    description = "A tool to scan code for license, copyright, package and their documented dependencies and other interesting facts";
    homepage = "https://github.com/nexB/scancode-toolkit";
    license = with licenses; [ asl20 cc-by-40 ];
    maintainers = teams.determinatesystems.members;
  };
}