Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,052 changes: 2,052 additions & 0 deletions result.json

Large diffs are not rendered by default.

22 changes: 20 additions & 2 deletions src/licensedcode/license_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import click
import saneyaml
import yaml

from commoncode.cliutils import MISC_GROUP
from commoncode.cliutils import PluggableCommandLineOption
Expand All @@ -29,6 +30,16 @@
TEMPLATES_DIR = os.path.join(dirname(__file__), 'templates')
STATIC_DIR = os.path.join(dirname(__file__), 'static')

def check_yaml_syntax(yaml_content, identifier):
"""
Ensure the generated YAML can be parsed strictly by PyYAML.
"""
try:
yaml.safe_load(yaml_content)
except yaml.YAMLError as e:
raise ValueError(f"Unable to parse generated YAML for {identifier}: {e}")



def write_file(path, filename, content):
path.joinpath(filename).open("w").write(content)
Expand Down Expand Up @@ -96,10 +107,13 @@ def generate_indexes(output_path, environment, licenses, test=False):
"index.json",
json.dumps(index, indent=2, sort_keys=False)
)
index_yaml_content = saneyaml.dump(index, indent=2)
check_yaml_syntax(index_yaml_content, "index.yml")

write_file(
output_path,
"index.yml",
saneyaml.dump(index, indent=2)
index_yaml_content
)
return len(index)

Expand Down Expand Up @@ -131,10 +145,14 @@ def generate_details(output_path, environment, licenses, test=False):
license_data=license_data,
)
write_file(output_path, f"{lic.key}.html", html)

yaml_content = saneyaml.dump(license_data_with_text, indent=2)
check_yaml_syntax(yaml_content, f"license: {lic.key}")

write_file(
output_path,
f"{lic.key}.yml",
saneyaml.dump(license_data_with_text, indent=2)
yaml_content
)
write_file(
output_path,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
---
key: bash-exception-gpl
short_name: Bash exception to GPL
name: Bash exception to GPL
category: Copyleft
owner: Free Software Foundation (FSF)
notes: this used with GPL 1.0 and 2.0. It was removed from the V3 text https://git.savannah.gnu.org/cgit/bash.git/commit/COPYING?id=3185942a5234e26ab13fa02f9c51d340cec514f8
is_exception: yes
spdx_license_key: LicenseRef-scancode-bash-exception-gpl-2.0
text_urls:
- https://git.savannah.gnu.org/cgit/bash.git/plain/COPYING?h=bash-3.0-rc1&id=dd9e6dfa23d0dae4888f11fb8c6a27bc36d1b283
---

The Free Software Foundation has exempted Bash from the requirement of
Paragraph 2c of the General Public License. This is to say, there is
no requirement for Bash to print a notice when it is started
interactively in the usual way. We made this exception because users
and standards expect shells not to print such messages. This
exception applies to any program that serves as a shell and that is
---
key: bash-exception-gpl
short_name: Bash exception to GPL
name: Bash exception to GPL
category: Copyleft
owner: Free Software Foundation (FSF)
notes: this used with GPL 1.0 and 2.0. It was removed from the V3 text https://git.savannah.gnu.org/cgit/bash.git/commit/COPYING?id=3185942a5234e26ab13fa02f9c51d340cec514f8
is_exception: yes
spdx_license_key: LicenseRef-scancode-bash-exception-gpl-2.0
text_urls:
- https://git.savannah.gnu.org/cgit/bash.git/plain/COPYING?h=bash-3.0-rc1&id=dd9e6dfa23d0dae4888f11fb8c6a27bc36d1b283
---
The Free Software Foundation has exempted Bash from the requirement of
Paragraph 2c of the General Public License. This is to say, there is
no requirement for Bash to print a notice when it is started
interactively in the usual way. We made this exception because users
and standards expect shells not to print such messages. This
exception applies to any program that serves as a shell and that is
based primarily on Bash as opposed to other GNU software.
Loading