buildframework/helium/external/python/lib/2.5/Sphinx-0.5.1-py2.5.egg/sphinx/__init__.py
changeset 179 d8ac696cc51f
parent 1 be27ed110b50
child 180 e02a83d4c571
child 592 3215c239276a
equal deleted inserted replaced
1:be27ed110b50 179:d8ac696cc51f
     1 # -*- coding: utf-8 -*-
       
     2 """
       
     3     Sphinx
       
     4     ~~~~~~
       
     5 
       
     6     The Sphinx documentation toolchain.
       
     7 
       
     8     :copyright: 2007-2008 by Georg Brandl.
       
     9     :license: BSD.
       
    10 """
       
    11 
       
    12 import sys
       
    13 
       
    14 __revision__ = '$Revision$'
       
    15 __version__ = '0.5.1'
       
    16 __released__ = '0.5.1'
       
    17 
       
    18 
       
    19 def main(argv=sys.argv):
       
    20     if sys.version_info[:3] < (2, 4, 0):
       
    21         print >>sys.stderr, \
       
    22               'Error: Sphinx requires at least Python 2.4 to run.'
       
    23         return 1
       
    24 
       
    25     try:
       
    26         from sphinx import cmdline
       
    27     except ImportError, err:
       
    28         errstr = str(err)
       
    29         if errstr.lower().startswith('no module named'):
       
    30             whichmod = errstr[16:]
       
    31             if whichmod.startswith('docutils'):
       
    32                 whichmod = 'Docutils library'
       
    33             elif whichmod.startswith('jinja'):
       
    34                 whichmod = 'Jinja library'
       
    35             elif whichmod == 'roman':
       
    36                 whichmod = 'roman module (which is distributed with Docutils)'
       
    37             else:
       
    38                 whichmod += ' module'
       
    39             print >>sys.stderr, \
       
    40                   'Error: The %s cannot be found. Did you install Sphinx '\
       
    41                   'and its dependencies correctly?' % whichmod
       
    42             return 1
       
    43         raise
       
    44     return cmdline.main(argv)
       
    45 
       
    46 
       
    47 if __name__ == '__main__':
       
    48     sys.exit(main(sys.argv))