Giter Site home page Giter Site logo

anthonyharrison / sbom2doc Goto Github PK

View Code? Open in Web Editor NEW
12.0 2.0 3.0 86 KB

Transform SBOM contents into a formatted document including markdown and PDF formats

License: Apache License 2.0

Python 100.00%
sbom sbom-tool cyclonedx devsecops markdown-generator pdf-generation spdx

sbom2doc's Issues

Missing dependency: requests

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

License download broken after adding Supplier Summary

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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.