project/build
This commit is contained in:
parent
c8bab902b2
commit
534e91ce36
1 changed files with 14 additions and 22 deletions
36
build.py
36
build.py
|
@ -1,46 +1,38 @@
|
||||||
#! /usr/bin/python3 -B
|
#! /usr/bin/env -S python3 -B
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
import sphinx.cmd.build
|
from pathlib import Path
|
||||||
|
|
||||||
|
from rwx.prj.sphinx import SphinxProject
|
||||||
|
|
||||||
TRAVAUX = [
|
TRAVAUX = [
|
||||||
# 'thesis',
|
# "thesis",
|
||||||
]
|
]
|
||||||
INPUT = ['cnam']
|
OUTPUT = "out"
|
||||||
OUTPUT = 'out'
|
|
||||||
|
|
||||||
|
|
||||||
def others():
|
def others():
|
||||||
travaux = os.path.join('cnam')
|
travaux = os.path.join("cnam")
|
||||||
for travail in TRAVAUX:
|
for travail in TRAVAUX:
|
||||||
subprocess.call([os.path.join(travaux, travail, 'build.py')])
|
subprocess.call([os.path.join(travaux, travail, "build.py")])
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
file = os.path.realpath(__file__)
|
file = os.path.realpath(__file__)
|
||||||
directory = os.path.dirname(file)
|
directory = os.path.dirname(file)
|
||||||
os.chdir(directory)
|
os.chdir(directory)
|
||||||
|
# projects
|
||||||
others()
|
others()
|
||||||
|
# project
|
||||||
|
sys.exit(SphinxProject(Path(__file__)).build())
|
||||||
output_directory = os.path.join(directory, OUTPUT)
|
output_directory = os.path.join(directory, OUTPUT)
|
||||||
shutil.rmtree(output_directory, ignore_errors=True)
|
shutil.rmtree(output_directory, ignore_errors=True)
|
||||||
for doc in INPUT:
|
sphinx.cmd.build.build_main(arguments)
|
||||||
arguments = [
|
|
||||||
'-E',
|
|
||||||
'-j', '2',
|
|
||||||
'-b', 'html',
|
|
||||||
'-D', 'project={}'.format(doc),
|
|
||||||
'-D', 'master_doc={}'.format('index'),
|
|
||||||
'-D', 'html_theme={}'.format('sphinx_rtd_theme'),
|
|
||||||
# '-C',
|
|
||||||
'-c', directory,
|
|
||||||
os.path.join(directory, doc),
|
|
||||||
os.path.join(output_directory, doc),
|
|
||||||
]
|
|
||||||
sphinx.cmd.build.build_main(arguments)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue