Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scancode-toolkit 32 breaks this tool #17

Closed
fmauch opened this issue Jul 12, 2023 · 3 comments · Fixed by #18
Closed

scancode-toolkit 32 breaks this tool #17

fmauch opened this issue Jul 12, 2023 · 3 comments · Fixed by #18

Comments

@fmauch
Copy link
Contributor

fmauch commented Jul 12, 2023

Hi,

I was just about to try this tool and it instantly failed:

Traceback (most recent call last):
  File "/home/mauch/.local/bin/ros_license_toolkit", line 7, in <module>
    exec(compile(f.read(), __file__, 'exec'))
  File "/home/mauch/local_install/src/ros_license_toolkit/bin/ros_license_toolkit", line 42, in <module>
    sys.exit(main(args=sys.argv[1:]))
  File "/home/mauch/local_install/src/ros_license_toolkit/src/ros_license_toolkit/main.py", line 80, in main
    packages = get_packages_in_path(parsed_args.path)
  File "/home/mauch/local_install/src/ros_license_toolkit/src/ros_license_toolkit/package.py", line 212, in get_packages_in_path
    repo: Optional[Repo] = Repo(os.path.abspath(path))
  File "/home/mauch/local_install/src/ros_license_toolkit/src/ros_license_toolkit/repo.py", line 83, in __init__
    if is_license_text_file(scan_results):
  File "/home/mauch/local_install/src/ros_license_toolkit/src/ros_license_toolkit/common.py", line 24, in is_license_text_file
    for _license in scan_results["licenses"]:
KeyError: 'licenses'

A bit debugging revealed that the text that is searched for doesn't exist at all in the scan output. So I tried using an older version of scancode-toolkit (31.2.6) and it suddently worked.

scancode-toolkit v32.0.4 produces another output on a BSD-3-Clause LICENSE file:

{'detected_license_expression': 'bsd-new', 'detected_license_expression_spdx': 'BSD-3-Clause', 'license_detections': [{'license_expression': 'bsd-new', 'matches': [{'score': 100.0, 'start_line': 1, 'end_line': 25, 'matched_length': 213, 'match_coverage': 100.0, 'matcher': '1-hash', 'license_expression': 'bsd-new', 'rule_identifier': 'bsd-new_577.RULE', 'rule_relevance': 100, 'rule_url': 'https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/bsd-new_577.RULE'}], 'identifier': 'bsd_new-5be47247-8ec7-7f95-1b90-0aaa3275e0c2'}], 'license_clues': [], 'percentage_of_license_text': 100.0}

For now things work for me with scancode 31.2.6 installed, but since the setup.py doesn't specify a version, this might make other people run into this / will lead to problems in future when newer scancode versions should be supported.

@ct2034
Copy link
Member

ct2034 commented Jul 12, 2023

@fmauch Thank you very much for taking the time to report the issue and the investigation. 💯

@fmauch
Copy link
Contributor Author

fmauch commented Jul 12, 2023

@ct2034 thanks for the quick response. I am confused that you created #18 and closed it deleting the branch without merging it. Is there a reason for that?

@ct2034
Copy link
Member

ct2034 commented Jul 12, 2023

Thanks for the heads-up. I guess I can respond quickly but not also correctly. This is why I can never have free lunch. :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants