hledger/tools/runhledgerhpc
2011-04-22 18:47:12 +00:00

32 lines
1.0 KiB
Python

#!/usr/bin/env python
# runhledgerhpc "HPCCOMMAND [HPCARGS]" [HLEDGERARGS]
#
# A front-end that resets the tix count, runs hledgerhpc with the
# specified hledger args, and runs hpc with the specified hpc args.
# Should be run from hledger's top source directory.
#
# Eg:
# hledger$ tools/runhledgerhpc report test
# hledger$ tools/runhledgerhpc "markup --destdir=coverage" test 'some unit test'
hledgerhpc="hledgerhpc"
verbosity = 0 # 0=no output, 1=stderr only, 2=stdout+stderr
import sys, os
hpcargs, hledgerargs = sys.argv[1], ' '.join(sys.argv[2:])
# remove old tix files
os.system("rm -f %s.tix" % hledgerhpc)
# run the hpc-enabled binary with the specified hledger arguments to generate tix files
if verbosity<1:
os.system("bin/%s %s >/dev/null 2>&1" % (hledgerhpc,hledgerargs))
elif verbosity==1:
os.system("bin/%s %s >/dev/null" % (hledgerhpc,hledgerargs))
else:
os.system("bin/%s %s" % (hledgerhpc,hledgerargs))
# run the specified hpc command on the tix files
os.system("hpc %s %s" % (hpcargs,hledgerhpc))