Clean up unittest attempt.

This commit is contained in:
Kylian Schmidt
2025-09-08 12:53:16 +02:00
parent 657b273975
commit 9e59d06796
22 changed files with 17 additions and 7476 deletions
+17 -20
View File
@@ -15,15 +15,14 @@ Features:
import subprocess
import shutil
import os
import sys
from pathlib import Path
from typing import Dict, Any, Optional
from datetime import datetime
from jinja2 import Environment, FileSystemLoader
from orchestration.config import Config
from orchestration.metadata import (
from utils.config import Config
from utils.metadata import (
load_folder_metadata,
merge_metadata,
resolve_metadata_for_plot,
@@ -122,7 +121,7 @@ def build_gallery(source_dir: Path, web_dir: Path,
"""
if relative_path is None:
relative_path = Path(".")
if inherited_metadata is None:
inherited_metadata = {}
@@ -186,7 +185,7 @@ def build_gallery(source_dir: Path, web_dir: Path,
subdir_names.append(subdir.name)
output_html = web_dir / "index.html"
# Always regenerate HTML to ensure subdirectory changes are reflected
# This ensures new subdirectories appear in navigation
force_regeneration = True
@@ -336,7 +335,7 @@ def main(clean_first: bool = False) -> None:
# Always ensure assets are up to date
assets_src = Path("assets")
assets_dst = gallery_root.parent / "assets"
if assets_src.exists():
# Update assets if they don't exist or are outdated
main_css_src = assets_src / "css" / "main.css"
@@ -400,7 +399,7 @@ def main(clean_first: bool = False) -> None:
# Calculate relative path to assets for single file
# Single files are at depth 1 (gallery_root/source.name/index.html)
assets_path = "../assets"
output_html = source_web_dir / "index.html"
with output_html.open("w") as f:
f.write(template.render(
@@ -414,7 +413,8 @@ def main(clean_first: bool = False) -> None:
folder_metadata={},
assets_path=assets_path,
source_dir=str(source_path.parent),
metadata_file_path=get_metadata_file_path(source_path.parent)
metadata_file_path=get_metadata_file_path(
source_path.parent)
))
print(f"Generated {output_html}")
@@ -433,16 +433,13 @@ def main(clean_first: bool = False) -> None:
if __name__ == "__main__":
if 'GATEWAY_INTERFACE' in os.environ:
refresh_gallery_cgi()
else:
import argparse
import argparse
parser = argparse.ArgumentParser(description='Generate gallery')
parser.add_argument(
'--clean',
action='store_true',
help='Clean gallery directory before generation'
)
args = parser.parse_args()
main(clean_first=args.clean)
parser = argparse.ArgumentParser(description='Generate gallery')
parser.add_argument(
'--clean',
action='store_true',
help='Clean gallery directory before generation'
)
args = parser.parse_args()
main(clean_first=args.clean)