From d6b6d095773db2ffe304b02fecd5fba061c7483d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Rapinat?= Date: Mon, 3 Dec 2012 18:48:03 +0000 Subject: [PATCH] 5621: test for docutils svn: r20764 --- data/man/update_man.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/data/man/update_man.py b/data/man/update_man.py index 43cc127e8..f8a4f2210 100644 --- a/data/man/update_man.py +++ b/data/man/update_man.py @@ -36,6 +36,12 @@ import os import sys from argparse import ArgumentParser +DOCUTILS = True +try: + import docutils.core, docutils.writers +except: + DOCUTILS = False + LANGUAGES = ['sv', 'nl', 'pl', 'cs', 'pt_BR', 'fr'] VERSION = '4.0.0' DATE = '' @@ -70,6 +76,9 @@ def tests(): os.system('''%(program)s''' % {'program': sphinxCmd}) except: print ('Please, install sphinx') + + if not DOCUTILS: + print('\nNo docutils support, cannot use -m/--man and -o/--odt arguments.') def main(): """ @@ -106,10 +115,10 @@ def main(): if args.build: build() - if args.man: + if args.man and DOCUTILS: man() - if args.odt: + if args.odt and DOCUTILS: odt() def build(): @@ -143,6 +152,9 @@ def build(): def man(): """ man file generation via docutils (python) + + from docutils.core import publish_cmdline, default_description + from docutils.writers import manpage """ os.system('''rst2man en.rst gramps.1''') @@ -154,6 +166,9 @@ def man(): def odt(): """ odt file generation via docutils (python) + + from docutils.core import publish_cmdline_to_binary, default_description + from docutils.writers.odf_odt import Writer, Reader """ os.system('''rst2odt en.rst gramps.odt''')