cnam.marc/build.py

45 lines
1 KiB
Python
Raw Normal View History

2019-09-08 20:15:32 +02:00
#! /usr/bin/python3 -B
import os
import shutil
2020-04-27 22:42:53 +02:00
import subprocess
2019-09-08 20:15:32 +02:00
2020-05-19 16:50:44 +02:00
import sphinx.cmd.build
2019-09-08 20:15:32 +02:00
2020-09-26 00:52:12 +02:00
TRAVAUX = ['mémoire']
INPUT = ['cnam']
OUTPUT = 'out'
2019-09-08 20:15:32 +02:00
2020-04-27 12:46:18 +02:00
def others():
2020-04-27 22:42:53 +02:00
travaux = os.path.join('cnam', 'travaux')
for travail in TRAVAUX:
subprocess.call([os.path.join(travaux, travail, 'build.py')])
2020-04-27 12:46:18 +02:00
2019-09-08 20:15:32 +02:00
def main():
file = os.path.realpath(__file__)
directory = os.path.dirname(file)
2020-04-27 22:42:53 +02:00
os.chdir(directory)
others()
2019-09-08 20:15:32 +02:00
output_directory = os.path.join(directory, OUTPUT)
shutil.rmtree(output_directory, ignore_errors=True)
for doc in INPUT:
arguments = [
2020-09-26 00:52:12 +02:00
'-E',
'-j', '2',
'-b', 'html',
'-D', 'project={}'.format(doc),
'-D', 'master_doc={}'.format('index'),
'-D', 'html_theme={}'.format('sphinx_rtd_theme'),
# '-C',
'-c', directory,
2019-09-08 20:15:32 +02:00
os.path.join(directory, doc),
os.path.join(output_directory, doc),
]
2020-05-19 16:50:44 +02:00
sphinx.cmd.build.build_main(arguments)
2019-09-08 20:15:32 +02:00
2020-09-26 00:52:12 +02:00
if __name__ == '__main__':
2019-09-08 20:15:32 +02:00
main()