1{ lib
2, attrs
3, beautifulsoup4
4, bitarray
5, boolean-py
6, buildPythonPackage
7, chardet
8, click
9, colorama
10, commoncode
11, container-inspector
12, debian-inspector
13, dparse2
14, extractcode
15, extractcode-7z
16, extractcode-libarchive
17, fasteners
18, fetchPypi
19, fetchpatch
20, fingerprints
21, ftfy
22, gemfileparser2
23, html5lib
24, importlib-metadata
25, intbitset
26, jaraco-functools
27, javaproperties
28, jinja2
29, jsonstreams
30, license-expression
31, lxml
32, markupsafe
33, packageurl-python
34, packaging
35, parameter-expansion-patched
36, pefile
37, pip-requirements-parser
38, pkginfo2
39, pluggy
40, plugincode
41, publicsuffix2
42, pyahocorasick
43, pycryptodome
44, pygmars
45, pygments
46, pymaven-patch
47, pytestCheckHook
48, pythonOlder
49, requests
50, saneyaml
51, spdx-tools
52, text-unidecode
53, toml
54, typecode
55, typecode-libmagic
56, typing
57, urlpy
58, xmltodict
59, zipp
60}:
61
62buildPythonPackage rec {
63 pname = "scancode-toolkit";
64 version = "32.0.6";
65
66 disabled = pythonOlder "3.6";
67
68 src = fetchPypi {
69 inherit pname version;
70 hash = "sha256-suqk7LOnZgSJGlaHq81LDOSCHZWdsJOUbma6MEpHxSM=";
71 };
72
73 dontConfigure = true;
74
75 propagatedBuildInputs = [
76 attrs
77 beautifulsoup4
78 bitarray
79 boolean-py
80 chardet
81 click
82 colorama
83 commoncode
84 container-inspector
85 debian-inspector
86 dparse2
87 extractcode
88 extractcode-7z
89 extractcode-libarchive
90 fasteners
91 fingerprints
92 ftfy
93 gemfileparser2
94 html5lib
95 importlib-metadata
96 intbitset
97 jaraco-functools
98 javaproperties
99 jinja2
100 jsonstreams
101 license-expression
102 lxml
103 markupsafe
104 packageurl-python
105 packaging
106 parameter-expansion-patched
107 pefile
108 pip-requirements-parser
109 pkginfo2
110 pluggy
111 plugincode
112 publicsuffix2
113 pyahocorasick
114 pycryptodome
115 pygmars
116 pygments
117 pymaven-patch
118 requests
119 saneyaml
120 spdx-tools
121 text-unidecode
122 toml
123 typecode
124 typecode-libmagic
125 urlpy
126 xmltodict
127 ] ++ lib.optionals (pythonOlder "3.9") [
128 zipp
129 ] ++ lib.optionals (pythonOlder "3.7") [
130 typing
131 ];
132
133 nativeCheckInputs = [
134 pytestCheckHook
135 ];
136
137 patches = [
138 (fetchpatch {
139 name = "${pname}-allow-stable-spdx-tools.patch";
140 url = "https://github.com/nexB/scancode-toolkit/commit/d89ab6584d3df6b7eb1d1394559e9d967d6db6ae.patch";
141 includes = [ "src/*" ];
142 hash = "sha256-AU3vJlOxmCy3yvkupVaAVxAKxJI3ymXEk+A5DWSkfOM=";
143 })
144 ];
145
146 postPatch = ''
147 substituteInPlace setup.cfg \
148 --replace "pdfminer.six >= 20200101" "pdfminer.six" \
149 --replace "pluggy >= 0.12.0, < 1.0" "pluggy" \
150 --replace "pygmars >= 0.7.0" "pygmars" \
151 --replace "license_expression >= 21.6.14" "license_expression" \
152 --replace "intbitset >= 2.3.0, < 3.0" "intbitset" \
153 --replace "spdx_tools == 0.7.0a3" "spdx_tools"
154 '';
155
156 # Importing scancode needs a writeable home, and preCheck happens in between
157 # pythonImportsCheckPhase and pytestCheckPhase.
158 postInstall = ''
159 export HOME=$(mktemp -d)
160 '';
161
162 pythonImportsCheck = [
163 "scancode"
164 ];
165
166 # takes a long time and doesn't appear to do anything
167 dontStrip = true;
168
169 meta = with lib; {
170 description = "Tool to scan code for license, copyright, package and their documented dependencies and other interesting facts";
171 homepage = "https://github.com/nexB/scancode-toolkit";
172 changelog = "https://github.com/nexB/scancode-toolkit/blob/v${version}/CHANGELOG.rst";
173 license = with licenses; [ asl20 cc-by-40 ];
174 maintainers = with maintainers; [ ];
175 };
176}