diff options
author | Elena ``of Valhalla'' Grandi <elena.valhalla@gmail.com> | 2011-04-19 19:14:33 +0200 |
---|---|---|
committer | Elena ``of Valhalla'' Grandi <elena.valhalla@gmail.com> | 2011-04-19 19:14:33 +0200 |
commit | 0a2be34e9e2bf6e9e9ef023dd36088733007e155 (patch) | |
tree | dca2f6b24ec0cc2f984eddc5eb5550c57c0ff076 | |
parent | c554c90fac9eff37df768b9c091f6fc4e2eb94cf (diff) |
make_guides.py: funzione build_pdf (generazione di PDF da LaTeX)
-rwxr-xr-x | make_guides.py | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/make_guides.py b/make_guides.py index d55d8e5..d46ba13 100755 --- a/make_guides.py +++ b/make_guides.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -import argparse, os +import argparse, os, shutil import docutils.core def basename(fname): @@ -85,12 +85,22 @@ def build_pdf(guide): return None except OSError: pass - # DEBUG - print('Building PDF...') if not os.path.isdir(dist_dir): os.mkdir(dist_dir) - fp = open(os.path.join(dist_dir,pdf_name),'w') - fp.close() + os.chdir(build_dir) + try: + if os.system('pdflatex '+tex_name) == 0: + if os.system('pdflatex '+tex_name) == 0: + os.system('pdflatex '+tex_name) + except OSError: + return False + finally: + os.chdir('../../') + try: + shutil.move(os.path.join(build_dir,pdf_name), + os.path.join(dist_dir,pdf_name)) + except IOError: + return False def build_nup_pdf(guide): '''Builds the nup-ed PDF for the guide''' |