diff options
author | Lars Wirzenius <liw@liw.fi> | 2014-07-06 14:54:59 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2014-07-06 14:54:59 +0100 |
commit | 17973dc2561b4a4581c66f959def497472574be2 (patch) | |
tree | 8651c7a2fee68908512efd7e77b4dc809467b8bb /setup.py | |
parent | be2e5e860a743485da1ffbee546d4830d22c1556 (diff) | |
download | obnam-17973dc2561b4a4581c66f959def497472574be2.tar.gz |
Build obnam.1.txt in setup.py
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 29 |
1 files changed, 23 insertions, 6 deletions
@@ -59,12 +59,29 @@ class Build(build): def run(self): build.run(self) - - print 'building manpages' - for x in ['obnam']: - with open('%s.1' % x, 'w') as f: - runcmd(['python', x, '--generate-manpage=%s.1.in' % x, - '--output=%s.1' % x], stdout=f) + self.build_manpage('obnam') + + def build_manpage(self, program): + print 'building manpage for %s' % program + self.generate_troff(program) + self.format_txt(program) + + def generate_troff(self, program): + with open('%s.1' % program, 'w') as f: + cliapp.runcmd( + ['python', program, '--generate-manpage=%s.1.in' % program, + '--output=%s.1' % program], + stdout=f) + + def format_txt(self, program): + env = dict(os.environ) + env['MANWIDTH'] = '80' + with open('%s.1.txt' % program, 'w') as f: + cliapp.runcmd( + ['man', '-l', '%s.1' % program], + ['col', '-b'], + stdout=f, + env=env) class BuildDocs(Command): |