-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
Fix classifier parsing in python 3.8 / python 3.9 #431
Conversation
Could you add proper (unit or integration) tests to prove that your changes actually work? Additionally, could you please sign your commit according to https://github.com/CycloneDX/cyclonedx-python/pull/431/checks?check_run_id=9224681013 ? |
thank you for the pull request, @a1lu . please follow https://github.com/CycloneDX/cyclonedx-python/blob/master/CONTRIBUTING.md I set your pull-request to "draft" state, as this PR is not ready for review. |
Sure, Unfortunately I have only access to the github web IDE right now. I can do this probably during this week. |
I added tests to check if both license entries are present. One from the license field and one from the classifiers. Also I changed the classifier generation, as I discovered that the python3.10 version did not work on poetry run tox. No all versions use the same generator and the tests pass. Though I need to give mypy a hint to not generate an error. I am going to squash the commits later (I am still only on github web IDE) and sign the commit. |
Thanks for the code, @a1lu could you sign your commits according to https://github.com/CycloneDX/cyclonedx-python/pull/431/checks?check_run_id=9242986125 |
@madpah please review this PR :D |
The original code did not loop the classifier, but the characters of the first classifier. This commit fixes this and improves the test case to test that both, the licence from the License field and the license classifier is parsed correctly Signed-off-by: a1lu <github.foreshoe@slmail.me>
@jkowalleck I squashed my commits and signed them. Do we also want to parse the license file metadata entry? Or use the |
great 👍
I would suggest to open an individual issue for each one of these topics, so we could discuss the need, the details and everything. |
The classifier parser did not work as expected on my machine.
In python3.8 and python3.9 the type
email.message import Message
is used as metadata type and the metadata are stored ini_metadata._headers
as a list of tuples. To iterate over the classifiers in this list of tupleswas used. Though this loop iterates only over the first classifiers characters and not over all classifiers, so the classifiers were never parsed.
I propose in this commit to generate a list of classifiers for python3.8/python3.9 and python3.10 separately and loop over the list of classifiers.
Please note:
I created this PR on github web, I guess the commit message needs to be adjusted before merging!