MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / regenerate

Function regenerate

src/packagedcode/regen_package_docs.py:28–50  ·  view source on GitHub ↗

Generate a licenseDB static website and dump license data at ``build_location`` given a license directory ``licenses_data_dir`` using templates from ``template_dir``. ``test`` is to generate a stable output for testing only

(
    doc_location,
    template_dir=TEMPLATES_DIR,
)

Source from the content-addressed store, hash-verified

26
27
28def regenerate(
29 doc_location,
30 template_dir=TEMPLATES_DIR,
31):
32 """
33 Generate a licenseDB static website and dump license data at
34 ``build_location`` given a license directory ``licenses_data_dir`` using
35 templates from ``template_dir``. ``test`` is to generate a stable output for
36 testing only
37 """
38 environment = Environment(
39 loader=FileSystemLoader(template_dir),
40 autoescape=True,
41 )
42 doc_path = pathlib.Path(doc_location)
43
44 all_available_packages = get_available_package_parsers(docs=True)
45
46 license_list_template = environment.get_template("available_package_parsers.rst")
47 packages_doc = license_list_template.render(
48 all_available_packages=all_available_packages,
49 )
50 write_file(file_path=doc_path, content=packages_doc)
51
52
53

Callers 1

regen_package_docsFunction · 0.85

Calls 4

EnvironmentClass · 0.85
write_fileFunction · 0.70
renderMethod · 0.45

Tested by

no test coverage detected