Skip to content
Merged
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
7 changes: 0 additions & 7 deletions scoreboard/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,3 @@ add_custom_target(
${OUTPUT_DIR}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMENT "Running main.py")

add_custom_command(
TARGET generate_scoreboard
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/static
${OUTPUT_DIR}/static
COMMENT "Copying static directory to binary directory")
15 changes: 14 additions & 1 deletion scoreboard/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import argparse
import subprocess
import yaml
import shutil
from jinja2 import Environment, FileSystemLoader
import logging

Expand Down Expand Up @@ -228,10 +229,22 @@ def main():
)
args = parser.parse_args()

output_file = Path(args.output) / "index.html"
output_path = Path(args.output)
output_path.mkdir(parents=True, exist_ok=True)
output_file = output_path / "index.html"
with open(output_file, "w") as file:
file.write(html_content)

static_src = script_dir / "static"
static_dst = output_path / "static"
if static_src.exists():
if static_dst.exists():
shutil.rmtree(static_dst)
shutil.copytree(static_src, static_dst)
logger.info("Static directory copied to %s", static_dst)
else:
logger.warning("Static directory not found at %s", static_src)

logger.info("HTML page generated at %s", output_file)


Expand Down
Loading