summaryrefslogtreecommitdiff
path: root/support/asymptote/__main__.py
diff options
context:
space:
mode:
authorMichael Schwarz <michi.schwarz@gmail.com>2015-09-11 22:03:03 +0200
committerMichael Schwarz <michi.schwarz@gmail.com>2015-09-16 01:50:23 +0200
commit93f96964914ae30686d30e5667bff92f2d17b791 (patch)
tree60cd3f1f3df32911818f9d9ae2519564b3e55528 /support/asymptote/__main__.py
parent0c5b944686a8f7f11461faece073607ff0a41c8a (diff)
downloadpogojig-93f96964914ae30686d30e5667bff92f2d17b791.tar.gz
pogojig-93f96964914ae30686d30e5667bff92f2d17b791.tar.bz2
pogojig-93f96964914ae30686d30e5667bff92f2d17b791.zip
Check for Asymptote not writing a PDF file.
If no drawing commands are called in an Asymptote script, no PDF output is created and no error is generated. This confuses the build process, which expect a target to exist after its commands were called. With this change, the Python wrapper checks whether a PDF was actually written and throws an error otherwise.
Diffstat (limited to 'support/asymptote/__main__.py')
-rw-r--r--support/asymptote/__main__.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/support/asymptote/__main__.py b/support/asymptote/__main__.py
index 5c6f67a..91902dd 100644
--- a/support/asymptote/__main__.py
+++ b/support/asymptote/__main__.py
@@ -17,6 +17,9 @@ def main(in_path, out_path):
# Asymptote creates A LOT of temp files (presumably when invoking LaTeX) and leaves some of them behind. Thus we run asymptote in a temporary directory.
_asymptote(absolute_in_path, 'out', os.path.dirname(absolute_in_path), temp_dir)
+ if not os.path.exists(temp_out_path):
+ raise util.UserError('Asymptote did not generate a PDF file for input file {}.', in_path)
+
shutil.copyfile(temp_out_path, out_path)
else:
raise Exception('Unknown file type: {}'.format(out_suffix))