vercors.me : collecte Météo-France / Infoclimat / VP2, archive SQLite, accueil en carte, forum (squelette)
- collecte : collecter_meteofrance, extraire_infoclimat, extraire_vp2, archiver_historique, importer_opendata ; WeatherLink allégé (alleger) - tests : meteofrance, infoclimat, vp2, archive, opendata (tous verts) - maquettes/accueil-carte : sources de la maquette (générateurs de tuiles, page, À propos, CGU, confidentialité) - forum : noyau local (rôles, droits, SQLite, serveur de test, 18 tests) - deploy : Caddyfile.vercors.me.v2 (non appliqué) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Cette révision appartient à :
1 Parent
956d08ffd7
révision
ff42faca16
42 fichiers modifiés
+5127
Aucun fichier ne correspond à votre recherche
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Assemble le site publiable de vercors.me dans <projet>/site-v2/ à partir de la maquette.
|
||||
|
||||
site-v2/index.html, a-propos.html, (cgu.html, confidentialite.html si présents), polices/, tuiles/, data/ (vide)
|
||||
Les JSON de données (data/*.json, data/semaine/) sont produits sur cornafserver et copiés sur le serveur public à part.
|
||||
Usage : python assembler.py
|
||||
"""
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
ICI = os.path.dirname(os.path.abspath(__file__))
|
||||
DEST = os.path.join(os.path.dirname(os.path.dirname(ICI)), "site-v2")
|
||||
PAGES = ("index.html", "a-propos.html", "cgu.html", "confidentialite.html")
|
||||
|
||||
|
||||
def main():
|
||||
shutil.rmtree(DEST, ignore_errors=True)
|
||||
os.makedirs(os.path.join(DEST, "data"))
|
||||
for nom in PAGES:
|
||||
src = os.path.join(ICI, "a-propos-build.html" if nom == "a-propos.html" else nom)
|
||||
if os.path.exists(src):
|
||||
shutil.copy(src, os.path.join(DEST, nom))
|
||||
for dossier in ("polices", "tuiles"):
|
||||
src = os.path.join(ICI, dossier)
|
||||
if os.path.isdir(src):
|
||||
shutil.copytree(src, os.path.join(DEST, dossier), ignore=shutil.ignore_patterns("*.css"))
|
||||
# contrôle : aucune ressource distante dans les pages
|
||||
for nom in os.listdir(DEST):
|
||||
if nom.endswith(".html"):
|
||||
texte = open(os.path.join(DEST, nom), encoding="utf-8").read()
|
||||
for motif in ("https://fonts.", "//cdn.", "<script src=\"http", "<link href=\"http"):
|
||||
if motif in texte:
|
||||
print("ATTENTION : ressource distante dans", nom, motif)
|
||||
return 1
|
||||
taille = sum(os.path.getsize(os.path.join(d, f)) for d, _, fs in os.walk(DEST) for f in fs)
|
||||
print("site-v2 assemblé : %d fichiers, %.1f Mo -> %s" % (sum(len(f) for _, _, f in os.walk(DEST)), taille / 1e6, DEST))
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Référencer dans un nouveau ticket
Bloquer un utilisateur