Skip to content

Commit 3722dd1

Browse files
authored
Merge pull request #3202 from nexB/fix-license-dump
Restore help.html from aboutcode-org/scancode-licensedb#23
2 parents ebe35cb + d4fed87 commit 3722dd1

16 files changed

+779
-412
lines changed

Diff for: src/licensedcode/templates/help.html

+334-183
Large diffs are not rendered by default.

Diff for: src/scancode/outdated.py

+27-4
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@
3030

3131
import datetime
3232
import json
33+
import os
3334
import logging
34-
from os import path
35+
import sys
3536

3637
from packvers import version as packaging_version
3738
import requests
@@ -54,9 +55,22 @@
5455

5556
SELFCHECK_DATE_FMT = "%Y-%m-%dT%H:%M:%SZ"
5657

58+
TRACE = os.environ.get('SCANCODE_DEBUG_OUTDATED', False)
59+
60+
def logger_debug(*args):
61+
pass
62+
63+
5764
logger = logging.getLogger(__name__)
58-
# logging.basicConfig(stream=sys.stdout)
59-
# logger.setLevel(logging.WARNING)
65+
66+
if TRACE:
67+
68+
if TRACE:
69+
logging.basicConfig(stream=sys.stdout)
70+
logger.setLevel(logging.DEBUG)
71+
72+
def logger_debug(*args):
73+
return logger.debug(' '.join(isinstance(a, str) and a or repr(a) for a in args))
6074

6175

6276
def total_seconds(td):
@@ -70,7 +84,7 @@ def total_seconds(td):
7084
class VersionCheckState:
7185

7286
def __init__(self):
73-
self.statefile_path = path.join(
87+
self.statefile_path = os.path.join(
7488
scancode_cache_dir, 'scancode-version-check.json')
7589
self.lockfile_path = self.statefile_path + '.lockfile'
7690
# Load the existing state
@@ -154,6 +168,11 @@ def fetch_newer_version(
154168
State is stored in the scancode_cache_dir.
155169
If `force` is True, redo a PyPI remote check.
156170
"""
171+
# If installed version is from git describe, only use the first part of it
172+
# i.e. `v31.2.1-343-gd9d2e19e32` -> `v31.2.1`
173+
if "-" in installed_version:
174+
installed_version = installed_version.split("-")[0]
175+
157176
try:
158177
installed_version = packaging_version.parse(installed_version)
159178
state = VersionCheckState()
@@ -185,6 +204,10 @@ def fetch_newer_version(
185204

186205
latest_version = packaging_version.parse(latest_version)
187206

207+
if TRACE:
208+
logger_debug(f"installed_version: {installed_version}, latest version: {latest_version}")
209+
logger_debug(f"installed_version < latest_version: {installed_version < latest_version}")
210+
188211
# Determine if our latest_version is older
189212
if (installed_version < latest_version
190213
and installed_version.base_version != latest_version.base_version):

Diff for: tests/licensedcode/data/license_db/license_dump/bash-exception-gpl.html

+6-3
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,12 @@
148148
<a href="https://github.com/nexB/scancode-licensedb" target="_blank">GitHub</a> ·
149149
<a href="https://www.aboutcode.org/" target="_blank">AboutCode</a>
150150
</p>
151-
<p>Designed and built by <a href="https://www.nexb.com/" target="_blank">nexB</a>. Licensed under the <a href="cc-by-4.0.html">Creative Commons Attribution License 4.0 (CC-BY-4.0)</a>.</p>
152-
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a> 32.0.0b1 on Dec 22, 2022.</p>
153-
<p>This is updated daily automatically with latest updates from the develop branch of scancode-toolkit, if any.</p>
151+
<p>Designed and built by <a href="https://www.nexb.com/" target="_blank">nexB</a>.
152+
Licensed under the <a href="cc-by-4.0.html">Creative Commons Attribution License 4.0 (CC-BY-4.0)</a>.</p>
153+
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a>
154+
32.0.0b1 on Dec 22, 2022.</p>
155+
<p>SPDX Licenses list version: 3.19</p>
156+
154157
</footer>
155158
</div>
156159

Diff for: tests/licensedcode/data/license_db/license_dump/binary-linux-firmware.html

+6-3
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,12 @@
151151
<a href="https://github.com/nexB/scancode-licensedb" target="_blank">GitHub</a> ·
152152
<a href="https://www.aboutcode.org/" target="_blank">AboutCode</a>
153153
</p>
154-
<p>Designed and built by <a href="https://www.nexb.com/" target="_blank">nexB</a>. Licensed under the <a href="cc-by-4.0.html">Creative Commons Attribution License 4.0 (CC-BY-4.0)</a>.</p>
155-
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a> 32.0.0b1 on Dec 22, 2022.</p>
156-
<p>This is updated daily automatically with latest updates from the develop branch of scancode-toolkit, if any.</p>
154+
<p>Designed and built by <a href="https://www.nexb.com/" target="_blank">nexB</a>.
155+
Licensed under the <a href="cc-by-4.0.html">Creative Commons Attribution License 4.0 (CC-BY-4.0)</a>.</p>
156+
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a>
157+
32.0.0b1 on Dec 22, 2022.</p>
158+
<p>SPDX Licenses list version: 3.19</p>
159+
157160
</footer>
158161
</div>
159162

Diff for: tests/licensedcode/data/license_db/license_dump/bison-exception-2.0.html

+6-3
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,12 @@
155155
<a href="https://github.com/nexB/scancode-licensedb" target="_blank">GitHub</a> ·
156156
<a href="https://www.aboutcode.org/" target="_blank">AboutCode</a>
157157
</p>
158-
<p>Designed and built by <a href="https://www.nexb.com/" target="_blank">nexB</a>. Licensed under the <a href="cc-by-4.0.html">Creative Commons Attribution License 4.0 (CC-BY-4.0)</a>.</p>
159-
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a> 32.0.0b1 on Dec 22, 2022.</p>
160-
<p>This is updated daily automatically with latest updates from the develop branch of scancode-toolkit, if any.</p>
158+
<p>Designed and built by <a href="https://www.nexb.com/" target="_blank">nexB</a>.
159+
Licensed under the <a href="cc-by-4.0.html">Creative Commons Attribution License 4.0 (CC-BY-4.0)</a>.</p>
160+
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a>
161+
32.0.0b1 on Dec 22, 2022.</p>
162+
<p>SPDX Licenses list version: 3.19</p>
163+
161164
</footer>
162165
</div>
163166

Diff for: tests/licensedcode/data/license_db/license_dump/bison-exception-2.2.html

+6-3
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,12 @@
182182
<a href="https://github.com/nexB/scancode-licensedb" target="_blank">GitHub</a> ·
183183
<a href="https://www.aboutcode.org/" target="_blank">AboutCode</a>
184184
</p>
185-
<p>Designed and built by <a href="https://www.nexb.com/" target="_blank">nexB</a>. Licensed under the <a href="cc-by-4.0.html">Creative Commons Attribution License 4.0 (CC-BY-4.0)</a>.</p>
186-
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a> 32.0.0b1 on Dec 22, 2022.</p>
187-
<p>This is updated daily automatically with latest updates from the develop branch of scancode-toolkit, if any.</p>
185+
<p>Designed and built by <a href="https://www.nexb.com/" target="_blank">nexB</a>.
186+
Licensed under the <a href="cc-by-4.0.html">Creative Commons Attribution License 4.0 (CC-BY-4.0)</a>.</p>
187+
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a>
188+
32.0.0b1 on Dec 22, 2022.</p>
189+
<p>SPDX Licenses list version: 3.19</p>
190+
188191
</footer>
189192
</div>
190193

Diff for: tests/licensedcode/data/license_db/license_dump/bittorrent-1.0.html

+6-3
Original file line numberDiff line numberDiff line change
@@ -482,9 +482,12 @@
482482
<a href="https://github.com/nexB/scancode-licensedb" target="_blank">GitHub</a> ·
483483
<a href="https://www.aboutcode.org/" target="_blank">AboutCode</a>
484484
</p>
485-
<p>Designed and built by <a href="https://www.nexb.com/" target="_blank">nexB</a>. Licensed under the <a href="cc-by-4.0.html">Creative Commons Attribution License 4.0 (CC-BY-4.0)</a>.</p>
486-
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a> 32.0.0b1 on Dec 22, 2022.</p>
487-
<p>This is updated daily automatically with latest updates from the develop branch of scancode-toolkit, if any.</p>
485+
<p>Designed and built by <a href="https://www.nexb.com/" target="_blank">nexB</a>.
486+
Licensed under the <a href="cc-by-4.0.html">Creative Commons Attribution License 4.0 (CC-BY-4.0)</a>.</p>
487+
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a>
488+
32.0.0b1 on Dec 22, 2022.</p>
489+
<p>SPDX Licenses list version: 3.19</p>
490+
488491
</footer>
489492
</div>
490493

Diff for: tests/licensedcode/data/license_db/license_dump/bittorrent-1.1.html

+6-3
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,12 @@
301301
<a href="https://github.com/nexB/scancode-licensedb" target="_blank">GitHub</a> ·
302302
<a href="https://www.aboutcode.org/" target="_blank">AboutCode</a>
303303
</p>
304-
<p>Designed and built by <a href="https://www.nexb.com/" target="_blank">nexB</a>. Licensed under the <a href="cc-by-4.0.html">Creative Commons Attribution License 4.0 (CC-BY-4.0)</a>.</p>
305-
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a> 32.0.0b1 on Dec 22, 2022.</p>
306-
<p>This is updated daily automatically with latest updates from the develop branch of scancode-toolkit, if any.</p>
304+
<p>Designed and built by <a href="https://www.nexb.com/" target="_blank">nexB</a>.
305+
Licensed under the <a href="cc-by-4.0.html">Creative Commons Attribution License 4.0 (CC-BY-4.0)</a>.</p>
306+
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a>
307+
32.0.0b1 on Dec 22, 2022.</p>
308+
<p>SPDX Licenses list version: 3.19</p>
309+
307310
</footer>
308311
</div>
309312

Diff for: tests/licensedcode/data/license_db/license_dump/bittorrent-1.2.html

+6-3
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,12 @@
219219
<a href="https://github.com/nexB/scancode-licensedb" target="_blank">GitHub</a> ·
220220
<a href="https://www.aboutcode.org/" target="_blank">AboutCode</a>
221221
</p>
222-
<p>Designed and built by <a href="https://www.nexb.com/" target="_blank">nexB</a>. Licensed under the <a href="cc-by-4.0.html">Creative Commons Attribution License 4.0 (CC-BY-4.0)</a>.</p>
223-
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a> 32.0.0b1 on Dec 22, 2022.</p>
224-
<p>This is updated daily automatically with latest updates from the develop branch of scancode-toolkit, if any.</p>
222+
<p>Designed and built by <a href="https://www.nexb.com/" target="_blank">nexB</a>.
223+
Licensed under the <a href="cc-by-4.0.html">Creative Commons Attribution License 4.0 (CC-BY-4.0)</a>.</p>
224+
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a>
225+
32.0.0b1 on Dec 22, 2022.</p>
226+
<p>SPDX Licenses list version: 3.19</p>
227+
225228
</footer>
226229
</div>
227230

Diff for: tests/licensedcode/data/license_db/license_dump/bittorrent-eula.html

+6-3
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,12 @@
178178
<a href="https://github.com/nexB/scancode-licensedb" target="_blank">GitHub</a> ·
179179
<a href="https://www.aboutcode.org/" target="_blank">AboutCode</a>
180180
</p>
181-
<p>Designed and built by <a href="https://www.nexb.com/" target="_blank">nexB</a>. Licensed under the <a href="cc-by-4.0.html">Creative Commons Attribution License 4.0 (CC-BY-4.0)</a>.</p>
182-
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a> 32.0.0b1 on Dec 22, 2022.</p>
183-
<p>This is updated daily automatically with latest updates from the develop branch of scancode-toolkit, if any.</p>
181+
<p>Designed and built by <a href="https://www.nexb.com/" target="_blank">nexB</a>.
182+
Licensed under the <a href="cc-by-4.0.html">Creative Commons Attribution License 4.0 (CC-BY-4.0)</a>.</p>
183+
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a>
184+
32.0.0b1 on Dec 22, 2022.</p>
185+
<p>SPDX Licenses list version: 3.19</p>
186+
184187
</footer>
185188
</div>
186189

Diff for: tests/licensedcode/data/license_db/license_dump/boost-1.0.html

+6-3
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,12 @@
182182
<a href="https://github.com/nexB/scancode-licensedb" target="_blank">GitHub</a> ·
183183
<a href="https://www.aboutcode.org/" target="_blank">AboutCode</a>
184184
</p>
185-
<p>Designed and built by <a href="https://www.nexb.com/" target="_blank">nexB</a>. Licensed under the <a href="cc-by-4.0.html">Creative Commons Attribution License 4.0 (CC-BY-4.0)</a>.</p>
186-
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a> 32.0.0b1 on Dec 22, 2022.</p>
187-
<p>This is updated daily automatically with latest updates from the develop branch of scancode-toolkit, if any.</p>
185+
<p>Designed and built by <a href="https://www.nexb.com/" target="_blank">nexB</a>.
186+
Licensed under the <a href="cc-by-4.0.html">Creative Commons Attribution License 4.0 (CC-BY-4.0)</a>.</p>
187+
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a>
188+
32.0.0b1 on Dec 22, 2022.</p>
189+
<p>SPDX Licenses list version: 3.19</p>
190+
188191
</footer>
189192
</div>
190193

Diff for: tests/licensedcode/data/license_db/license_dump/boost-original.html

+6-3
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,12 @@
161161
<a href="https://github.com/nexB/scancode-licensedb" target="_blank">GitHub</a> ·
162162
<a href="https://www.aboutcode.org/" target="_blank">AboutCode</a>
163163
</p>
164-
<p>Designed and built by <a href="https://www.nexb.com/" target="_blank">nexB</a>. Licensed under the <a href="cc-by-4.0.html">Creative Commons Attribution License 4.0 (CC-BY-4.0)</a>.</p>
165-
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a> 32.0.0b1 on Dec 22, 2022.</p>
166-
<p>This is updated daily automatically with latest updates from the develop branch of scancode-toolkit, if any.</p>
164+
<p>Designed and built by <a href="https://www.nexb.com/" target="_blank">nexB</a>.
165+
Licensed under the <a href="cc-by-4.0.html">Creative Commons Attribution License 4.0 (CC-BY-4.0)</a>.</p>
166+
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a>
167+
32.0.0b1 on Dec 22, 2022.</p>
168+
<p>SPDX Licenses list version: 3.19</p>
169+
167170
</footer>
168171
</div>
169172

Diff for: tests/licensedcode/data/license_db/license_dump/bootloader-exception.html

+6-3
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,12 @@
208208
<a href="https://github.com/nexB/scancode-licensedb" target="_blank">GitHub</a> ·
209209
<a href="https://www.aboutcode.org/" target="_blank">AboutCode</a>
210210
</p>
211-
<p>Designed and built by <a href="https://www.nexb.com/" target="_blank">nexB</a>. Licensed under the <a href="cc-by-4.0.html">Creative Commons Attribution License 4.0 (CC-BY-4.0)</a>.</p>
212-
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a> 32.0.0b1 on Dec 22, 2022.</p>
213-
<p>This is updated daily automatically with latest updates from the develop branch of scancode-toolkit, if any.</p>
211+
<p>Designed and built by <a href="https://www.nexb.com/" target="_blank">nexB</a>.
212+
Licensed under the <a href="cc-by-4.0.html">Creative Commons Attribution License 4.0 (CC-BY-4.0)</a>.</p>
213+
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a>
214+
32.0.0b1 on Dec 22, 2022.</p>
215+
<p>SPDX Licenses list version: 3.19</p>
216+
214217
</footer>
215218
</div>
216219

Diff for: tests/licensedcode/data/license_db/license_dump/bsla.html

+6-3
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,12 @@
138138
<a href="https://github.com/nexB/scancode-licensedb" target="_blank">GitHub</a> ·
139139
<a href="https://www.aboutcode.org/" target="_blank">AboutCode</a>
140140
</p>
141-
<p>Designed and built by <a href="https://www.nexb.com/" target="_blank">nexB</a>. Licensed under the <a href="cc-by-4.0.html">Creative Commons Attribution License 4.0 (CC-BY-4.0)</a>.</p>
142-
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a> 32.0.0b1 on Dec 22, 2022.</p>
143-
<p>This is updated daily automatically with latest updates from the develop branch of scancode-toolkit, if any.</p>
141+
<p>Designed and built by <a href="https://www.nexb.com/" target="_blank">nexB</a>.
142+
Licensed under the <a href="cc-by-4.0.html">Creative Commons Attribution License 4.0 (CC-BY-4.0)</a>.</p>
143+
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a>
144+
32.0.0b1 on Dec 22, 2022.</p>
145+
<p>SPDX Licenses list version: 3.19</p>
146+
144147
</footer>
145148
</div>
146149

0 commit comments

Comments
 (0)