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

Unhashable type SpdxNoAssertion #805

Closed
nathanjacobiOXOS opened this issue May 7, 2024 · 2 comments
Closed

Unhashable type SpdxNoAssertion #805

nathanjacobiOXOS opened this issue May 7, 2024 · 2 comments

Comments

@nathanjacobiOXOS
Copy link

Hi there, if any relationships contain a NOASSERTION relationship, represented by the object SpdxNoAssertion(), then there will be a failure to write to file

  File "path/to/lib/spdx_tools/spdx/writer/tagvalue/tagvalue_writer_helper_functions.py", line 89, in scan_relationships
    and relationship.related_spdx_element_id in files_by_spdx_id.keys()
TypeError: unhashable type: 'SpdxNoAssertion'

The current work around I found is changing the if statements in scan_relationships to the following (lines 87-89)

        if (
            relationship.relationship_type == RelationshipType.CONTAINS
            and relationship.spdx_element_id in packages_spdx_ids 
            and str(relationship.related_spdx_element_id) in files_by_spdx_id.keys()
        ):

Alternatively for a user side fix, replace your SpdxNoAssertion with "NOASSERTION" in any relationship or str(SpdxNoAssertion())

Also, I just want to voice some disappointment in the complete lack of backwards compatibility in the 0.7.1->0.8.0 upgrade. I appreciate this very useful tool and the work the developers do, but when it takes as much time to fix my old script that was working as it would to just manually write and SPDX document by hand, it is very frustrating for me as a user. I hope you consider more backwards compatibility in future major patches. Thanks!

@armintaenzertng
Copy link
Collaborator

Hi @nathanjacobiOXOS, thanks for using the spdx-tools!
The issue you describe has been fixed in #778. Unfortunately, we didn't have a release since then. It's high time for a new release, it seems! :)

Regarding your disappointment, we are truly sorry for the inconvenience. The decision to drop backwards compatibility was not made lighthearted, but ultimately the hope was to have a stronger foundation in the code base going forward with the tools.

@armintaenzertng
Copy link
Collaborator

Closing this as duplicate, please reopen if you disagree.

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

No branches or pull requests

2 participants