Skip to content

Commit

Permalink
scripts: add comment that the files are generated
Browse files Browse the repository at this point in the history
  • Loading branch information
schuellerf committed Aug 1, 2024
1 parent 96e6007 commit ed91c22
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
6 changes: 6 additions & 0 deletions scripts/pull_osbuild_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
import tempfile

TEMPLATE = """
<!--
[//]: # ( DO NOT MODIFY THIS FILE! )
[//]: # ( This content is generated by `scripts/pull_osbuild_modules.py` )
[//]: # ( Rather change the source of this: {originating_url} )
-->
# {title}
**{summary}**
Expand Down Expand Up @@ -81,6 +86,7 @@ def main():
),
schema_1=json.dumps(datas.get("schema", {}), indent=2),
schema_2=json.dumps(datas.get("schema_2", {}), indent=2),
originating_url=f"https://github.com/osbuild/osbuild/tree/main/{tiep}/{schema.name}",
)

(dest / f"{title}.md").write_text(text)
Expand Down
13 changes: 11 additions & 2 deletions scripts/pull_readmes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
import os
import requests

TEMPLATE = """
<!--
[//]: # ( DO NOT MODIFY THIS FILE! )
[//]: # ( This content is generated by `scripts/pull_readmes.py` )
[//]: # ( Rather change the source of this: {originating_url} )
-->
"""

def resolve_dirs(baseurl, relative_link):
"""
Expand Down Expand Up @@ -100,13 +107,15 @@ def main():
source, targetpath = line.strip().split(':')

if source and targetpath:
originating_url = f"{github_baseurl}/{source}"
print(f"Downloading {github_rawurl}/{source} to {targetpath}...")
download_file(f'{github_rawurl}/{source}', targetpath)
print("Download completed.")
parsed_md = parse_markdown_and_replace_links(targetpath, f'{github_baseurl}/{source}')

parsed_md = parse_markdown_and_replace_links(targetpath, originating_url)

with open(targetpath, 'w', encoding='utf-8') as output_file:
output_file.write(TEMPLATE.format(originating_url=originating_url))
output_file.write(parsed_md)

print(f"Parsing and link replacement completed. Output saved to '{targetpath}'")
Expand Down

0 comments on commit ed91c22

Please sign in to comment.