Skip to content
Ahmed Hisham Ismail edited this page Jul 3, 2014 · 3 revisions

The module spdx.writers.tagvalue contains methods for writing out an SPDX document in tag/value format.

Methods

write_document

Takes two parameters document and out out is any object that has a write method that takes as an argument a string to output, usually it's a file. This method prints the top-level document fields version, data_license and comment. It uses the other methods in this module to output the subcomponents of the Document creation_info, reviews, package and extracted_licenses.

It raises an InvalidDocumentError (defined in the same module) if the document.validate returns False.

Note:

Document validation is only partially implemented.

Specifically package, extracted_license and file validations are stubs that return True.

write_creation_info

Takes two arguments creation_info and out.

It writes out all the fields of creation_info in Tag/Value format.

write_review

Takes two arguments review and out.

It writes out all the fields of review in Tag/Value format.

write_extr_licens

Unimplemented, takes two arguments lics and out.

It writes out all the fields of lics in Tag/Value format.

write_package

Takes two arguments package and out.

It writes out all the fields of package in Tag/Value format.

write_file

Takes two arguments file and out.

It writes out all the fields of file in Tag/Value format.