2024-07-07 10:06:07 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
# Simply move the map.png file to the blog output dir
|
|
|
|
# since it won't do so automatically for pillow creations.
|
2024-07-07 20:29:59 +00:00
|
|
|
# A HACK TO PUT THE LEAFLET JS INTO THE CORRECT PUBLIC BLOG DIR
|
|
|
|
# will have to be changed when the hardcoded public dir path changes
|
2024-07-07 10:06:07 +00:00
|
|
|
|
|
|
|
import os
|
2024-07-07 20:29:59 +00:00
|
|
|
import shutil
|
2024-07-07 10:06:07 +00:00
|
|
|
import sys
|
2024-07-07 20:29:59 +00:00
|
|
|
from pathlib import Path
|
2024-07-07 10:06:07 +00:00
|
|
|
|
|
|
|
if not os.getenv("QUARTO_PROJECT_RENDER_ALL"):
|
|
|
|
sys.exit(0)
|
|
|
|
|
2024-07-07 20:29:59 +00:00
|
|
|
relative_pub_dir = Path(
|
|
|
|
"../../../../public/blog/2024-07-02-nuclear-explosions-analysis/"
|
|
|
|
)
|
|
|
|
|
2024-07-07 10:06:07 +00:00
|
|
|
q_output_dir = os.getenv("QUARTO_PROJECT_OUTPUT_DIR")
|
|
|
|
if not q_output_dir:
|
2024-07-07 20:29:59 +00:00
|
|
|
print(f"ERROR: output dir: {q_output_dir} DOES NOT EXIST.")
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
dest = Path(q_output_dir).joinpath(relative_pub_dir)
|
|
|
|
|
|
|
|
# Correct relative WORKING DIR DOES NOT EXIST
|
|
|
|
if not dest.is_dir():
|
|
|
|
print(f"ERROR: map.html destination path: {dest} DOES NOT EXIST.")
|
2024-07-07 10:06:07 +00:00
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
|
2024-07-07 20:29:59 +00:00
|
|
|
src = "map.html"
|
|
|
|
|
|
|
|
shutil.copy(src, dest)
|
|
|
|
|
|
|
|
print("sucessfully moved map.html to ")
|