anthonyharrison / sbom2doc Goto Github PK
View Code? Open in Web Editor NEWTransform SBOM contents into a formatted document including markdown and PDF formats
License: Apache License 2.0
Transform SBOM contents into a formatted document including markdown and PDF formats
License: Apache License 2.0
Hi,
After installation I have the following error:
$ sbom2doc.exe
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:/msys64/ucrt64/bin/sbom2doc.exe/__main__.py", line 4, in <module>
File "C:/msys64/ucrt64/lib/python3.11/site-packages/sbom2doc/cli.py", line 11, in <module>
import sbom2doc.generator as generator
File "C:/msys64/ucrt64/lib/python3.11/site-packages/sbom2doc/generator.py", line 4, in <module>
import requests
ModuleNotFoundError: No module named 'requests'
After installing requests
, no error anymore.
Thanks,
Olivier
The --include-license
feature is currently broken due to reuse of the freq
variable in generator.py.
Before 397ab4b this variable contained a map of licenses, but now it contains the suppliers. As a consequence, the license downloading code at the end of generator.py operates on incorrect input.
Here is a POC of a fix:
diff --git a/generator.py b/generator.py
index c9f3d6d..7cf088b 100644
--- a/generator.py
+++ b/generator.py
@@ -148,10 +148,10 @@ def generate_document(format, sbom_parser, filename, outfile, include_license):
sbom_document.createtable(["License", "Count"], [25, 6])
#
# Create an empty dictionary
- freq = {}
+ freqLicenses = {}
for items in sorted(sbom_licenses):
- freq[items] = sbom_licenses.count(items)
- for key, value in freq.items():
+ freqLicenses[items] = sbom_licenses.count(items)
+ for key, value in freqLicenses.items():
sbom_document.addrow([key, str(value)])
sbom_document.showtable(widths=[10, 4])
@@ -189,7 +189,7 @@ def generate_document(format, sbom_parser, filename, outfile, include_license):
if include_license:
sbom_document.pagebreak()
sbom_document.heading(1, "License Text")
- for key, value in freq.items():
+ for key, value in freqLicenses.items():
# Ignore undefined licenses or expressions
if key == "NOASSERTION" or license_info.license_expression(key):
continue
By the way, thanks for this useful tool!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.