mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-12 20:42:57 +00:00
Update update_wiki.py: fix for pattern download, build timestamps, additional checks
This commit is contained in:
@@ -52,7 +52,11 @@ def update_monthly_wiki_page(
|
|||||||
def get_manifest_timestamp(manifest_file: Path) -> str:
|
def get_manifest_timestamp(manifest_file: Path) -> str:
|
||||||
file_content = manifest_file.read_text()
|
file_content = manifest_file.read_text()
|
||||||
pos = file_content.find("Build timestamp: ")
|
pos = file_content.find("Build timestamp: ")
|
||||||
return file_content[pos + 16 : pos + 36]
|
timestamp = file_content[pos + 17 : pos + 37]
|
||||||
|
# Should be good enough till year 2100
|
||||||
|
assert timestamp.startswith("20"), timestamp
|
||||||
|
assert timestamp.endswith("Z"), timestamp
|
||||||
|
return timestamp
|
||||||
|
|
||||||
|
|
||||||
def get_manifest_month(manifest_file: Path) -> str:
|
def get_manifest_month(manifest_file: Path) -> str:
|
||||||
@@ -75,14 +79,18 @@ def remove_old_manifests(wiki_dir: Path) -> None:
|
|||||||
def update_wiki(wiki_dir: Path, hist_lines_dir: Path, manifests_dir: Path) -> None:
|
def update_wiki(wiki_dir: Path, hist_lines_dir: Path, manifests_dir: Path) -> None:
|
||||||
LOGGER.info("Updating wiki")
|
LOGGER.info("Updating wiki")
|
||||||
|
|
||||||
for manifest_file in manifests_dir.glob("*.md"):
|
manifest_files = list(manifests_dir.rglob("*.md"))
|
||||||
|
assert manifest_files, "expected to have some manifest files"
|
||||||
|
for manifest_file in manifest_files:
|
||||||
month = get_manifest_month(manifest_file)
|
month = get_manifest_month(manifest_file)
|
||||||
copy_to = wiki_dir / "manifests" / month / manifest_file.name
|
copy_to = wiki_dir / "manifests" / month / manifest_file.name
|
||||||
copy_to.parent.mkdir(exist_ok=True)
|
copy_to.parent.mkdir(exist_ok=True)
|
||||||
shutil.copy(manifest_file, copy_to)
|
shutil.copy(manifest_file, copy_to)
|
||||||
LOGGER.info(f"Added manifest file: {copy_to.relative_to(wiki_dir)}")
|
LOGGER.info(f"Added manifest file: {copy_to.relative_to(wiki_dir)}")
|
||||||
|
|
||||||
for build_history_line_file in sorted(hist_lines_dir.glob("*.txt")):
|
build_history_line_files = sorted(hist_lines_dir.rglob("*.txt"))
|
||||||
|
assert build_history_line_files, "expected to have some build history line files"
|
||||||
|
for build_history_line_file in build_history_line_files:
|
||||||
build_history_line = build_history_line_file.read_text()
|
build_history_line = build_history_line_file.read_text()
|
||||||
assert build_history_line.startswith("| `")
|
assert build_history_line.startswith("| `")
|
||||||
month = build_history_line[3:10]
|
month = build_history_line[3:10]
|
||||||
|
Reference in New Issue
Block a user