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

Upgrade the 'File' class to the SPDX 2.1 specification #73

Merged
merged 2 commits into from
Aug 8, 2018

Conversation

yash-nisar
Copy link
Contributor

Signed-off-by: Yash Nisar yash.nisar@somaiya.edu

@pombredanne
Copy link
Member

This needs to be updated to resolve merge conflicts.

Copy link
Member

@pombredanne pombredanne left a 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:
Copy link
Member

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)?

Copy link
Member

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 👍

Copy link
Contributor Author

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.

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):
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, my bad.

@@ -13,6 +13,7 @@
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import uuid
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 👍

@@ -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))
Copy link
Member

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))

Copy link
Contributor Author

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>
Signed-off-by: Yash Nisar <yash.nisar@somaiya.edu>
@pombredanne
Copy link
Member

LGTM! merging

@pombredanne pombredanne merged commit a2853b0 into spdx:master Aug 8, 2018
@yash-nisar yash-nisar deleted the file-spec-2.1 branch August 8, 2018 09:16
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 this pull request may close these issues.

2 participants