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
|
# -*- mode:python; coding:utf-8 -*-
def get_opts():
import atheist
return atheist.parser.option_list
def man_opts():
retval = []
for opt in get_opts():
_short = str.join('', opt._short_opts)
_long = opt._long_opts[0]
dest = opt.dest.upper() if opt.dest else ''
val = ''
if opt.takes_value():
if _short:
val = "%s %s, " % (_short, dest)
val += "%s=%s" % (_long, dest)
else:
if _short:
val = "%s, " % _short
val += _long
# print opt._short_opts, val
retval.append(val)
return retval
def doc_opts():
return ['cmdoption:: %s' % x for x in man_opts()]
# --help
t = Test('$atheist', expected=1)
t.post += FileContains('ABSOLUTELY NO WARRANTY')
for opt in man_opts():
t.post += FileContains(opt)
# sphinx documentation
atheist_doc = '$basedir/doc/intro.rst'
t = Test('cat %s' % atheist_doc)
t.pre += FileExists(atheist_doc)
for opt in doc_opts():
t.post += FileContains(opt)
# manpage
man_src = '$basedir/debian/atheist.xml'
man_dst = '$basedir/debian/atheist.1'
t = Test('./debian/rules %s' % man_dst)
t.pre += DebPkgInstalled("cdbs")
t.pre += FileExists(man_src)
t.gen += man_dst
t = Test('man %s | cat' % man_dst, shell=True)
for opt in man_opts():
t.post += FileContains(opt)
|