/usr/bin/gfs2doc is in gerris-mpi 20110329-dfsg.2-1build2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | #!/usr/bin/python
import sys
import os
import stat
import glob
import tempfile
sys.path.append("/usr/lib/gerris")
import gfs2tex
if len(sys.argv) < 2:
print "usage: gfs2doc DIR1 DIR2..."
sys.exit(1)
def myexit(s):
os.system("rm -r -f " + wdname)
sys.exit(s)
for d in sys.argv[1:]:
example = gfs2tex.Example(d)
example.write()
wdname = tempfile.mkdtemp()
tex = open(wdname + "/" + example.name + ".tex", "w")
tex.write(r"""
\documentclass[a4paper]{article}
\usepackage{hevea}
\usepackage[usenames]{color}
\usepackage{graphicx}
\usepackage{gfs}
\oddsidemargin=4mm
\evensidemargin=-1mm
\topmargin=-7mm
\textwidth=15.42cm
\textheight=23.2cm
\begin{document}
\section{Examples}
""")
tex.write(r"\input{" + example.name + "/" + example.name + ".tex" + "}\n")
tex.write("\\end{document}\n")
tex.close()
os.symlink(os.getcwd() + "/" + example.name, wdname + "/" + example.name)
if os.system("export TEXINPUTS=\".:/usr/share/gerris:\" " +\
"&& rm -r -f " + example.name + ".pdf " + example.name + "_html" +\
"&& cd " + wdname + \
"&& latex -interaction=nonstopmode 2>&1 " + example.name + ".tex" +\
"&& latex -interaction=nonstopmode " + example.name + ".tex") or \
os.system("cd " + wdname + \
"&& dvips -Ppdf -G0 " + example.name + ".dvi -o " + example.name + ".ps" +\
"&& ps2pdf -sPAPERSIZE=a4 -dMaxSubsetPct=100 -dCompatibilityLevel=1.2 -dSubsetFonts=true -dEmbedAllFonts=true " + example.name + ".ps " + example.name + ".pdf" +\
"&& mv " + example.name + ".pdf " + os.getcwd()):
print "\n\n**** Errors occured while generating file ****: " + example.name + ".pdf"
myexit(1)
print "\n\n**** Successfully generated file ****: " + example.name + ".pdf\n\n"
hname = wdname + "/" + example.name + "_html"
os.mkdir(hname)
os.symlink("../" + example.name, hname + "/" + example.name)
wdir = os.getcwd()
if os.system("export TEXINPUTS=\".:/usr/share/gerris:\" " +\
"&& cd " + wdname + \
"&& hevea -fix -I /usr/share/gerris " + example.name + ".tex" + \
"&& sh /usr/share/gerris/kaltura.sh " + example.name):
print "\n\n**** Errors occured while generating directory ****: " + example.name + "_html"
myexit(1)
os.system("export TEXINPUTS=\".:/usr/share/gerris:\" " +\
"&& cd " + wdname + \
"; imagen -res 600 -extra \"pnmscale 0.24\" " + example.name + " " + \
"; mv -f " + example.name + "[0-9][0-9][0-9].png " + example.name + ".html " + \
hname + \
"; mv " + hname + " " + wdir)
print "\n\n**** Successfully generated directory ****: " + example.name + "_html\n"
files = example.name + "/" + example.name + ".gfs"
for f in example.required:
files += " " + example.name + "/" + f
if os.system("tar czf " + example.name + ".tgz " + files):
print "**** Errors occured while generating file ****: " + example.name + ".tgz"
os.remove(example.name + ".tgz")
myexit(1)
status,msg = example.test()
if status != None:
print "**** Errors occured while generating file ****: " + example.name + ".tgz"
print " ".join(msg)
os.remove(example.name + ".tgz")
myexit(1)
print "**** Successfully generated file ****: " + example.name + ".tgz"
os.system("rm -r -f " + wdname)
|