Added pdflatex, kpsewhich and tikz.sty checks

Wed, 17 Nov 2010 11:38:09 +0000

author
Andy Buckley <andy@insectnation.org>
date
Wed, 17 Nov 2010 11:38:09 +0000
changeset 90
277475b5b93d
parent 89
2dcc3b4a39e1
child 91
99118ef791ea

Added pdflatex, kpsewhich and tikz.sty checks

slhaplot file | annotate | diff | comparison | revisions
     1.1 --- a/slhaplot	Wed Nov 03 09:49:41 2010 -0400
     1.2 +++ b/slhaplot	Wed Nov 17 11:38:09 2010 +0000
     1.3 @@ -471,9 +471,26 @@
     1.4          import tempfile, shutil, subprocess
     1.5          tmpdir = tempfile.mkdtemp()
     1.6          writeout(out, os.path.join(tmpdir, "mytmp.tex"))
     1.7 -        # TODO: Test for pdflatex
     1.8 -        # TODO: Test for tikz package
     1.9          ok = True
    1.10 +        ## Test for pdflatex
    1.11 +        if ok:
    1.12 +            p = subprocess.Popen(["which", "pdflatex"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    1.13 +            rtn = p.wait()
    1.14 +            if rtn != 0:
    1.15 +                sys.stderr.write("pdflatex could not be found: tikzpdf format mode cannot work\n")
    1.16 +                ok = False
    1.17 +        ## Test for tikz package
    1.18 +        if ok:
    1.19 +            p = subprocess.Popen(["which", "kpsewhich"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    1.20 +            rtn = p.wait()
    1.21 +            if rtn != 0:
    1.22 +                sys.stderr.write("WARNING: kpsewhich could not be found: check for tikz package cannot be run\n")
    1.23 +            else:
    1.24 +                p = subprocess.Popen(["kpsewhich", "tikz.sty"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    1.25 +                rtn = p.wait()
    1.26 +                if rtn != 0:
    1.27 +                    sys.stderr.write("tikz.sty could not be found: tikzpdf format mode cannot work\n")
    1.28 +                    ok = False
    1.29          try:
    1.30              p = subprocess.Popen(["pdflatex", "\scrollmode\input", "mytmp.tex"],
    1.31                                   stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=tmpdir)

mercurial