summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2014-07-06 14:54:59 +0100
committerLars Wirzenius <liw@liw.fi>2014-07-06 14:54:59 +0100
commit17973dc2561b4a4581c66f959def497472574be2 (patch)
tree8651c7a2fee68908512efd7e77b4dc809467b8bb /setup.py
parentbe2e5e860a743485da1ffbee546d4830d22c1556 (diff)
downloadobnam-17973dc2561b4a4581c66f959def497472574be2.tar.gz
Build obnam.1.txt in setup.py
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py29
1 files changed, 23 insertions, 6 deletions
diff --git a/setup.py b/setup.py
index a77d5c44..f9a8dd4d 100644
--- a/setup.py
+++ b/setup.py
@@ -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):