probatoire
This commit is contained in:
parent
d9e5ae4a96
commit
e250f6d006
9 changed files with 124 additions and 1 deletions
2
build.py
2
build.py
|
@ -6,7 +6,7 @@ import subprocess
|
|||
|
||||
import sphinx.cmd.build
|
||||
|
||||
TRAVAUX = ['blanc']
|
||||
TRAVAUX = ['probatoire']
|
||||
INPUT = ["cnam"]
|
||||
OUTPUT = "out"
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ Travaux
|
|||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
probatoire/index
|
||||
blanc/index
|
||||
image/index
|
||||
pitch/index
|
||||
|
|
1
cnam/travaux/probatoire/.gitignore
vendored
Normal file
1
cnam/travaux/probatoire/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/*.pdf
|
81
cnam/travaux/probatoire/build.py
Executable file
81
cnam/travaux/probatoire/build.py
Executable file
|
@ -0,0 +1,81 @@
|
|||
#! /usr/bin/python3 -B
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
DOCUMENTS = [
|
||||
('document', 'mémoire'),
|
||||
('présentation', 'présentation'),
|
||||
]
|
||||
TMP = 'tmp'
|
||||
|
||||
|
||||
def run(command):
|
||||
subprocess.call(command)
|
||||
|
||||
|
||||
def errun(command):
|
||||
return subprocess.check_output(
|
||||
command, stderr=subprocess.STDOUT)
|
||||
|
||||
|
||||
def build(sign):
|
||||
for en, fr in DOCUMENTS:
|
||||
command = ['xelatex', '-output-directory', TMP, en]
|
||||
run(command)
|
||||
run(['makeglossaries', '-d', TMP, en])
|
||||
run(['biber',
|
||||
'--input-directory', TMP,
|
||||
'--output-directory', TMP,
|
||||
en,
|
||||
])
|
||||
run(command)
|
||||
run(command)
|
||||
pdf = f'{fr}.pdf'
|
||||
os.rename(os.path.join(TMP, f'{en}.pdf'),
|
||||
os.path.join(TMP, pdf))
|
||||
if not sign:
|
||||
os.rename(os.path.join(TMP, pdf), pdf)
|
||||
else:
|
||||
run(['gpg',
|
||||
'--armor',
|
||||
'--detach-sign',
|
||||
os.path.join(TMP, pdf),
|
||||
])
|
||||
signature = f'{pdf}.asc'
|
||||
for f in [pdf, signature]:
|
||||
os.rename(os.path.join(TMP, f), f)
|
||||
lines = errun(['gpg',
|
||||
'--verify', signature, pdf,
|
||||
]).decode('u8').splitlines()
|
||||
id = lines[2].index('"')
|
||||
lines = [
|
||||
lines[0],
|
||||
lines[1],
|
||||
lines[2][:id] + lines[4][id:]
|
||||
.replace('@', ' @ ')
|
||||
.replace('.', ' ⋅ ')
|
||||
] + lines[5:]
|
||||
buffer = os.linesep.join(lines).encode('u8')
|
||||
with open(f'{pdf}.vrf', 'bw') as f:
|
||||
f.write(buffer)
|
||||
|
||||
|
||||
def clean():
|
||||
shutil.rmtree(TMP, ignore_errors=True)
|
||||
|
||||
|
||||
def main():
|
||||
file = os.path.realpath(__file__)
|
||||
directory = os.path.dirname(file)
|
||||
os.chdir(directory)
|
||||
clean()
|
||||
os.makedirs(TMP)
|
||||
build(len(sys.argv) > 1)
|
||||
clean()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
0
cnam/travaux/probatoire/document.bib
Normal file
0
cnam/travaux/probatoire/document.bib
Normal file
11
cnam/travaux/probatoire/document.tex
Normal file
11
cnam/travaux/probatoire/document.tex
Normal file
|
@ -0,0 +1,11 @@
|
|||
\documentclass[12pt]{extarticle}
|
||||
\newcommand{\import}[1]{\input{document/#1}}
|
||||
|
||||
\import{packages}
|
||||
|
||||
\bibliography{document}
|
||||
|
||||
\begin{document}
|
||||
|
||||
|
||||
\end{document}
|
12
cnam/travaux/probatoire/document/packages.tex
Normal file
12
cnam/travaux/probatoire/document/packages.tex
Normal file
|
@ -0,0 +1,12 @@
|
|||
\usepackage[a4paper,portrait,
|
||||
bmargin=20mm,lmargin=20mm,rmargin=20mm,tmargin=20mm]{geometry}
|
||||
\usepackage{extsizes}
|
||||
\usepackage{fontspec}
|
||||
|
||||
\usepackage{polyglossia}
|
||||
\setmainlanguage{french}
|
||||
|
||||
\usepackage[acronym,toc]{glossaries}
|
||||
|
||||
\usepackage[backend=biber,sorting=anyt]{biblatex}
|
||||
\usepackage{tocbibind}
|
7
cnam/travaux/probatoire/index.rst
Normal file
7
cnam/travaux/probatoire/index.rst
Normal file
|
@ -0,0 +1,7 @@
|
|||
Mémoire probatoire
|
||||
==================
|
||||
|
||||
.. toctree::
|
||||
:numbered: 2
|
||||
|
||||
probatoire
|
10
cnam/travaux/probatoire/probatoire.rst
Normal file
10
cnam/travaux/probatoire/probatoire.rst
Normal file
|
@ -0,0 +1,10 @@
|
|||
Sujet
|
||||
=====
|
||||
|
||||
* :download:`SVM <sujet.pdf>`
|
||||
|
||||
Livrables
|
||||
=========
|
||||
|
||||
* :download:`Mémoire <mémoire.pdf>`
|
||||
* :download:`Présentation <présentation.pdf>`
|
Loading…
Add table
Add a link
Reference in a new issue