]> git.lyx.org Git - lyx.git/blob - lib/scripts/gnuplot2pdf.py
DocBook: update links to LilyPond bugs.
[lyx.git] / lib / scripts / gnuplot2pdf.py
1 #!/usr/bin/python3
2
3 from subprocess import Popen, PIPE
4 from sys import argv, stderr, exit
5 import shutil
6
7 if (len(argv) != 3):
8     stderr.write("Usage: %s <src_file> <dst_file>\n" % argv[0])
9     exit(1)
10
11 with open(argv[1], 'rb') as fsrc:
12     subproc = Popen("gnuplot", shell=True, stdin=PIPE)
13     subproc.stdin.write(b"set terminal pdf\nset output '%s'\n" % argv[2].encode())
14     shutil.copyfileobj(fsrc, subproc.stdin)
15     subproc.stdin.write(b"exit\n")
16     subproc.communicate()