-
Notifications
You must be signed in to change notification settings - Fork 135
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
Upgrade the 'File' class to the SPDX 2.1 specification #73
Conversation
This needs to be updated to resolve merge conflicts. |
731d998
to
dca1bcd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice! ... I made a few minor comment for your review.
value = p[2] | ||
if not self.builder.doc_spdx_id_set: | ||
self.builder.set_doc_spdx_id(self.document, value) | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You will need to add support for packages there too, right (doc, package, file)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very simple and clean approach BTW 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You will need to add support for packages there too, right (doc, package, file)?
Yes, the only thing that remains is the support of packages. I plan to include that in the PR that contains support of the package
class.
spdx/parsers/tagvalue.py
Outdated
self.error = True | ||
msg = ERROR_MESSAGES['DOC_SPDX_ID_VALUE'].format(p.lineno(1)) | ||
self.logger.log(msg) | ||
# def p_doc_spdx_id_1(self, p): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not keep dead code around
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, my bad.
spdx/writers/rdf.py
Outdated
@@ -13,6 +13,7 @@ | |||
from __future__ import absolute_import | |||
from __future__ import print_function | |||
from __future__ import unicode_literals | |||
import uuid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need an empty line before this import
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 👍
spdx/writers/rdf.py
Outdated
@@ -208,7 +209,7 @@ def create_file_node(self, doc_file): | |||
""" | |||
Create a node for spdx.file. | |||
""" | |||
file_node = BNode() | |||
file_node = URIRef('http://www.spdx.org/files#' + str(doc_file.spdx_id)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could prefer .format
when possible rather than plain string concatenation.... e.g. something like:
'http://www.spdx.org/files#{id}'.format(id=str(doc_file.spdx_id))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Roger that.
Signed-off-by: Yash Nisar <yash.nisar@somaiya.edu>
dca1bcd
to
62239a0
Compare
Signed-off-by: Yash Nisar <yash.nisar@somaiya.edu>
LGTM! merging |
Signed-off-by: Yash Nisar yash.nisar@somaiya.edu