.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "automation/copy_lectures.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_automation_copy_lectures.py: Copy documentation ================== Copy all the documentation into one single folder in order to serve it through a server. .. GENERATED FROM PYTHON SOURCE LINES 11-14 paramètres root est là où sont compilés les packages dest est le répertoire destination .. GENERATED FROM PYTHON SOURCE LINES 14-22 .. code-block:: default import os root = os.path.normpath(os.path.abspath(os.path.join( os.path.dirname(__file__), "..", "..", "..", ".."))) dest = os.path.normpath(os.path.abspath(os.path.join( os.path.dirname(__file__), "..", "..", "..", "..", "..", "documentation"))) .. GENERATED FROM PYTHON SOURCE LINES 23-24 logging .. GENERATED FROM PYTHON SOURCE LINES 24-28 .. code-block:: default from pyquickhelper.loghelper import fLOG # publish_lectures fLOG(OutputPrint=True) .. GENERATED FROM PYTHON SOURCE LINES 29-30 import des fonctions dont on a besoin .. GENERATED FROM PYTHON SOURCE LINES 30-32 .. code-block:: default from pyquickhelper.filehelper import synchronize_folder, explore_folder_iterfile .. GENERATED FROM PYTHON SOURCE LINES 33-34 récupération des répertoires compilés via un serveur jenkins .. GENERATED FROM PYTHON SOURCE LINES 34-57 .. code-block:: default fLOG("Digging into ", root) sub = os.path.join("_doc", "sphinxdoc", "build", "html", "index.html") index = [] pattern = "^index.html$" done = {} for name in explore_folder_iterfile(root, pattern): if name.endswith(sub): pack = name[:len(name) - len(sub) - 1] parent, spl = os.path.split(pack) if "_UT_" in spl: parent, spl = os.path.split(parent) if "_UT_" in spl: raise ValueError(f"Something is weird with: '{name}'") index.append((spl, os.path.dirname(name))) if spl in done: raise ValueError("Duplicated package '{0}'.\n{1}".format( spl, "\n".join("{0}={1}".format(k, v) for k, v in sorted(done.items())))) fLOG(f"Found {len(index)} directories") for ind in index: fLOG(" ", ind) .. GENERATED FROM PYTHON SOURCE LINES 58-59 copies .. GENERATED FROM PYTHON SOURCE LINES 59-70 .. code-block:: default for pack, folder in index: fLOG("########################") fLOG("Copy of", pack) fLOG("########################") to = os.path.join(dest, pack) fLOG("destination", to) if not os.path.exists(to): os.makedirs(to) status_file = os.path.join(dest, pack + ".txt") synchronize_folder(folder, to, log1=True, copy_1to2=True, file_date=status_file) .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.000 seconds) .. _sphx_glr_download_automation_copy_lectures.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: copy_lectures.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: copy_lectures.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_