from pathlib import Path
import zipfile, shutil
src = Path("/mnt/data/glass_slab_project")
out = Path("/mnt/data/glass_slab_project_final")
if out.exists():
shutil.rmtree(out)
shutil.copytree(src, out)
# Make the GitHub Pages custom-domain file match the domain currently configured in Pages.
(out / "CNAME").write_text("www.measureglasslab.in.net\n", encoding="utf-8")
# Add a clear photography-photo placeholder inside the website's assets.
placeholder = out / "assets" / "photography-placeholder.svg"
placeholder.write_text("""""", encoding="utf-8")
# Insert the placeholder into the Photography section if it is not already present.
html_path = out / "index.html"
html = html_path.read_text(encoding="utf-8")
marker = '
📸 Our experiment
'
photo_heading = '
📷 Photography / Pixel Method
'
if "photography-placeholder.svg" not in html:
start = html.find(photo_heading)
pos = html.find(marker, start)
if pos != -1:
block = """
Real photography photos: [To be added]
"""
html = html[:pos] + block + html[pos:]
html_path.write_text(html, encoding="utf-8")
# Add a concise README for uploading the whole folder to GitHub Pages.
(out / "README.txt").write_text(
"""Glass Slab Physics Project — final website package
Upload the contents of this folder to the root of the main branch of the GitHub repository.
Included:
- index.html
- CNAME for www.measureglasslab.in.net
- Real Shadow, Parallax, Optical and Free-Fall photos
- Photography photo placeholder
- Conceptual animations for all four methods
- Method-wise observation/readings placeholders
- Error/uncertainty tables
- Final comparison table
- Free-fall failed-attempt story
- Tape Measure App joke ending
Replace the [—], [To be added], and observation placeholders when the final readings are available.
""", encoding="utf-8"
)
zip_path = Path("/mnt/data/glass_slab_project_final.zip")
if zip_path.exists():
zip_path.unlink()
with zipfile.ZipFile(zip_path, "w", zipfile.ZIP_DEFLATED) as z:
for p in out.rglob("*"):
if p.is_file():
z.write(p, p.relative_to(out.parent))
print(f"Created: {zip_path}")
print(f"Files: {sum(1 for p in out.rglob('*') if p.is_file())}")
print(f"Real experiment photos: {len(list((out/'assets').glob('*.jpeg')))}")