-
Notifications
You must be signed in to change notification settings - Fork 1
Models
Models for components of an SPDX document. Fields that could be None
are optional.
The spdx.document.Document
class represents the Document model, it is the top level of any spdx file.
Field | Type | Notes |
---|---|---|
version | spdx.version.Version |
The SPDX version, currently only version 1.2 is supported |
data_license | spdx.document.License |
Must be CC-1.0 can be created by License.from_identifier('CC-1.0')
|
comment | str |
Document comment, may be None
|
creation_info | spdx.creationinfo.CreationInfo |
The document's creation information |
package | spdx.package.Package |
The package described by the document |
extracted_licenses | list of spdx.document.License
|
Extracted Licenses, could be empty |
reviews | list of spdx.review.Review
|
Document Reviews could be empty |
The Document.validate
method checks all the fields of a document and returns true if they are all valid according to the standard. It takes an optional parameter messages
to append all error messages to it for displaying to the user.
TODO:
- Implement
validate_extraced_licenses
method.
The class spdx.creationinfo.Creator
represents a creator entity. It has a single field name and can be compared for equality with other Creators (does not check type).
The class spdx.creationinfo.Organization
represents an organization entity it extends spdx.creationinfo.Creator
and adds an email field. It also overrides the __eq__
method.
Provides __str__
and to_value
methods to convert to string representation i.e Organization: Acme inc.
The class spdx.creationinfo.Person
represents a Person entity, it extends spdx.creationinfo.Creator
to provide an email field. The Only difference between it and Organization is type in case a user needs that distinction.
Provides __str__
and to_value
methods to convert to string representation i.e Person: Joe
##Tool
The class spdx.creationinfo.Tool
represents a Tool entity, it extends spdx.creationinfo.Creator
It only has a name field. The only difference between it and Creator is type distinction.
Provides __str__
and to_value
methods to convert to string representation i.e Tool: Hammer
##CreationInfo
The class spdx.creationinfo.CreationInfo
represents a document's creation info.
Field | Type | Notes |
---|---|---|
creators | list of spdx.creationinfo.Creator or any subclass |
|
created | datetime.datetime |
Date of creation |
comment | str |
creation comment, could be None
|
license_list_version | spdx.version.Version |
By default set to the value of config.LICENSE_LIST_VERSION
|
###Methods
add_creator
: Appends a creator.
remove_creator
: removes a creator.
set_created_now
: sets creation date to datetime.utcnow()
validate
: Validates the fields. Appends error messages to messages parameter.
###Properties
created_iso_format
: Creation date as iso 8601 string.
The class spdx.version.Version
represents a version. It has two fields major and minor both integers.
The class method from_str
parses a string of the form N.N
where N is a number and returns a version.
It returns None if the string is invalid.
It also provides a __cmp__
method.
The class spdx.review.Review
represents a document's review.
A review has one reviewer and review date. It may also have a comment.
Field | Type | Notes |
---|---|---|
reviewer | Any subclass of spdx.creationinfo.Creator
|
|
review_date | datetime.datetime |
The time the review was done at |
comment | str |
Review comment, could be None
|
###Methods
set_review_date_now
: sets the review date to datetime.utcnow()
validate
: validates the fields of the review, messages parameter is a list of user friendly error messages.
###Properties
review_date_iso_format
: Returns review_date in iso 8601 format.
The class spdx.utils.NoAssert
represents a NOASSERTION
value. It only provides to_value()
and __str__
methods which return the string representation of the value.
The class spdx.utils.SPDXNone
represents a NONE
value. It only provides to_value()
and __str__
methods
which return the string representation of the value.
The class spdx.file.FileType
has three constants SOURCE
, BINARY
,ARCHIVE
and OTHER
.
The class spdx.file.File
represents an instance of file information; a file in the software package described by the SPDX document.
Field | Type | Notes |
---|---|---|
name | str |
|
comment | str |
Could be None
|
type | One of the FileType constants |
Could be None
|
chk_sum | str |
The file checksum, must be SHA1 |
conc_lics | subclass of spdx.document.License
|
|
licenses_in_file | List of spdx.document.License s at least one |
|
copyright | One of str , utils.NoAssert or None
|
|
notice | str |
could be None
|
contributers | list of str
|
|
dependencies | list of str
|
|
artificat_of_project_name | list of str
|
Possibly empty |
artifact_of_project_home | list of str
|
Possibly empty |
artifact_of_project_uri | list of str
|
Possibly empty |
TODO:
- Field validations
Coming Soon.
Coming Soon.
Coming Soon.