Skip to content

Commit

Permalink
Merge pull request #3202 from nexB/fix-license-dump
Browse files Browse the repository at this point in the history
  • Loading branch information
pombredanne authored Jan 18, 2023
2 parents ebe35cb + d4fed87 commit 3722dd1
Show file tree
Hide file tree
Showing 16 changed files with 779 additions and 412 deletions.
517 changes: 334 additions & 183 deletions src/licensedcode/templates/help.html

Large diffs are not rendered by default.

31 changes: 27 additions & 4 deletions src/scancode/outdated.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@

import datetime
import json
import os
import logging
from os import path
import sys

from packvers import version as packaging_version
import requests
Expand All @@ -54,9 +55,22 @@

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

TRACE = os.environ.get('SCANCODE_DEBUG_OUTDATED', False)

def logger_debug(*args):
pass


logger = logging.getLogger(__name__)
# logging.basicConfig(stream=sys.stdout)
# logger.setLevel(logging.WARNING)

if TRACE:

if TRACE:
logging.basicConfig(stream=sys.stdout)
logger.setLevel(logging.DEBUG)

def logger_debug(*args):
return logger.debug(' '.join(isinstance(a, str) and a or repr(a) for a in args))


def total_seconds(td):
Expand All @@ -70,7 +84,7 @@ def total_seconds(td):
class VersionCheckState:

def __init__(self):
self.statefile_path = path.join(
self.statefile_path = os.path.join(
scancode_cache_dir, 'scancode-version-check.json')
self.lockfile_path = self.statefile_path + '.lockfile'
# Load the existing state
Expand Down Expand Up @@ -154,6 +168,11 @@ def fetch_newer_version(
State is stored in the scancode_cache_dir.
If `force` is True, redo a PyPI remote check.
"""
# If installed version is from git describe, only use the first part of it
# i.e. `v31.2.1-343-gd9d2e19e32` -> `v31.2.1`
if "-" in installed_version:
installed_version = installed_version.split("-")[0]

try:
installed_version = packaging_version.parse(installed_version)
state = VersionCheckState()
Expand Down Expand Up @@ -185,6 +204,10 @@ def fetch_newer_version(

latest_version = packaging_version.parse(latest_version)

if TRACE:
logger_debug(f"installed_version: {installed_version}, latest version: {latest_version}")
logger_debug(f"installed_version < latest_version: {installed_version < latest_version}")

# Determine if our latest_version is older
if (installed_version < latest_version
and installed_version.base_version != latest_version.base_version):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,12 @@
<a href="https://github.com/nexB/scancode-licensedb" target="_blank">GitHub</a> ·
<a href="https://www.aboutcode.org/" target="_blank">AboutCode</a>
</p>
<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>
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a> 32.0.0b1 on Dec 22, 2022.</p>
<p>This is updated daily automatically with latest updates from the develop branch of scancode-toolkit, if any.</p>
<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>
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a>
32.0.0b1 on Dec 22, 2022.</p>
<p>SPDX Licenses list version: 3.19</p>

</footer>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,12 @@
<a href="https://github.com/nexB/scancode-licensedb" target="_blank">GitHub</a> ·
<a href="https://www.aboutcode.org/" target="_blank">AboutCode</a>
</p>
<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>
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a> 32.0.0b1 on Dec 22, 2022.</p>
<p>This is updated daily automatically with latest updates from the develop branch of scancode-toolkit, if any.</p>
<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>
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a>
32.0.0b1 on Dec 22, 2022.</p>
<p>SPDX Licenses list version: 3.19</p>

</footer>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,12 @@
<a href="https://github.com/nexB/scancode-licensedb" target="_blank">GitHub</a> ·
<a href="https://www.aboutcode.org/" target="_blank">AboutCode</a>
</p>
<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>
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a> 32.0.0b1 on Dec 22, 2022.</p>
<p>This is updated daily automatically with latest updates from the develop branch of scancode-toolkit, if any.</p>
<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>
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a>
32.0.0b1 on Dec 22, 2022.</p>
<p>SPDX Licenses list version: 3.19</p>

</footer>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,12 @@
<a href="https://github.com/nexB/scancode-licensedb" target="_blank">GitHub</a> ·
<a href="https://www.aboutcode.org/" target="_blank">AboutCode</a>
</p>
<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>
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a> 32.0.0b1 on Dec 22, 2022.</p>
<p>This is updated daily automatically with latest updates from the develop branch of scancode-toolkit, if any.</p>
<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>
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a>
32.0.0b1 on Dec 22, 2022.</p>
<p>SPDX Licenses list version: 3.19</p>

</footer>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 +482,12 @@
<a href="https://github.com/nexB/scancode-licensedb" target="_blank">GitHub</a> ·
<a href="https://www.aboutcode.org/" target="_blank">AboutCode</a>
</p>
<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>
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a> 32.0.0b1 on Dec 22, 2022.</p>
<p>This is updated daily automatically with latest updates from the develop branch of scancode-toolkit, if any.</p>
<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>
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a>
32.0.0b1 on Dec 22, 2022.</p>
<p>SPDX Licenses list version: 3.19</p>

</footer>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,12 @@
<a href="https://github.com/nexB/scancode-licensedb" target="_blank">GitHub</a> ·
<a href="https://www.aboutcode.org/" target="_blank">AboutCode</a>
</p>
<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>
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a> 32.0.0b1 on Dec 22, 2022.</p>
<p>This is updated daily automatically with latest updates from the develop branch of scancode-toolkit, if any.</p>
<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>
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a>
32.0.0b1 on Dec 22, 2022.</p>
<p>SPDX Licenses list version: 3.19</p>

</footer>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,12 @@
<a href="https://github.com/nexB/scancode-licensedb" target="_blank">GitHub</a> ·
<a href="https://www.aboutcode.org/" target="_blank">AboutCode</a>
</p>
<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>
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a> 32.0.0b1 on Dec 22, 2022.</p>
<p>This is updated daily automatically with latest updates from the develop branch of scancode-toolkit, if any.</p>
<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>
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a>
32.0.0b1 on Dec 22, 2022.</p>
<p>SPDX Licenses list version: 3.19</p>

</footer>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,12 @@
<a href="https://github.com/nexB/scancode-licensedb" target="_blank">GitHub</a> ·
<a href="https://www.aboutcode.org/" target="_blank">AboutCode</a>
</p>
<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>
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a> 32.0.0b1 on Dec 22, 2022.</p>
<p>This is updated daily automatically with latest updates from the develop branch of scancode-toolkit, if any.</p>
<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>
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a>
32.0.0b1 on Dec 22, 2022.</p>
<p>SPDX Licenses list version: 3.19</p>

</footer>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,12 @@
<a href="https://github.com/nexB/scancode-licensedb" target="_blank">GitHub</a> ·
<a href="https://www.aboutcode.org/" target="_blank">AboutCode</a>
</p>
<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>
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a> 32.0.0b1 on Dec 22, 2022.</p>
<p>This is updated daily automatically with latest updates from the develop branch of scancode-toolkit, if any.</p>
<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>
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a>
32.0.0b1 on Dec 22, 2022.</p>
<p>SPDX Licenses list version: 3.19</p>

</footer>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,12 @@
<a href="https://github.com/nexB/scancode-licensedb" target="_blank">GitHub</a> ·
<a href="https://www.aboutcode.org/" target="_blank">AboutCode</a>
</p>
<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>
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a> 32.0.0b1 on Dec 22, 2022.</p>
<p>This is updated daily automatically with latest updates from the develop branch of scancode-toolkit, if any.</p>
<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>
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a>
32.0.0b1 on Dec 22, 2022.</p>
<p>SPDX Licenses list version: 3.19</p>

</footer>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,12 @@
<a href="https://github.com/nexB/scancode-licensedb" target="_blank">GitHub</a> ·
<a href="https://www.aboutcode.org/" target="_blank">AboutCode</a>
</p>
<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>
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a> 32.0.0b1 on Dec 22, 2022.</p>
<p>This is updated daily automatically with latest updates from the develop branch of scancode-toolkit, if any.</p>
<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>
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a>
32.0.0b1 on Dec 22, 2022.</p>
<p>SPDX Licenses list version: 3.19</p>

</footer>
</div>

Expand Down
9 changes: 6 additions & 3 deletions tests/licensedcode/data/license_db/license_dump/bsla.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,12 @@
<a href="https://github.com/nexB/scancode-licensedb" target="_blank">GitHub</a> ·
<a href="https://www.aboutcode.org/" target="_blank">AboutCode</a>
</p>
<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>
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a> 32.0.0b1 on Dec 22, 2022.</p>
<p>This is updated daily automatically with latest updates from the develop branch of scancode-toolkit, if any.</p>
<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>
<p>Generated with <a href="https://github.com/nexB/scancode-toolkit" target="_blank">ScanCode toolkit</a>
32.0.0b1 on Dec 22, 2022.</p>
<p>SPDX Licenses list version: 3.19</p>

</footer>
</div>

Expand Down
Loading

0 comments on commit 3722dd1

Please sign in to comment.