/usr/share/pyshared/sphinx/__init__.py is in python-sphinx 1.1.3+dfsg-2ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | # -*- coding: utf-8 -*-
"""
Sphinx
~~~~~~
The Sphinx documentation toolchain.
:copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
# Keep this file executable as-is in Python 3!
# (Otherwise getting the version out of it from setup.py is impossible.)
import sys
from os import path
__version__ = '1.1.3'
__released__ = '1.1.3' # used when Sphinx builds its own docs
package_dir = '/usr/share/sphinx'
if '+' in __version__ or 'pre' in __version__:
# try to find out the changeset hash if checked out from hg, and append
# it to __version__ (since we use this value from setup.py, it gets
# automatically propagated to an installed copy as well)
try:
import subprocess
p = subprocess.Popen(['hg', 'id', '-i', '-R',
path.join(package_dir, '..')],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
if out:
__version__ += '/' + out.strip()
except Exception:
pass
def _create_sphinext_namespace():
# Create namespace package "sphinxcontrib".
import pkgutil
module_type = type(sys)
try:
sphinxcontrib = sys.modules['sphinxcontrib']
except LookupError:
sphinxcontrib = module_type('sphinxcontrib')
sphinxcontrib.__path__ = []
sys.modules[sphinxcontrib.__name__] = sphinxcontrib
sphinxcontrib.__path__ = pkgutil.extend_path(sphinxcontrib.__path__, sphinxcontrib.__name__)
_create_sphinext_namespace()
def main(argv=sys.argv):
"""Sphinx build "main" command-line entry."""
if sys.version_info[:3] < (2, 4, 0):
sys.stderr.write('Error: Sphinx requires at least '
'Python 2.4 to run.\n')
return 1
try:
from sphinx import cmdline
except ImportError:
err = sys.exc_info()[1]
errstr = str(err)
if errstr.lower().startswith('no module named'):
whichmod = errstr[16:]
hint = ''
if whichmod.startswith('docutils'):
whichmod = 'Docutils library'
elif whichmod.startswith('jinja'):
whichmod = 'Jinja2 library'
elif whichmod == 'roman':
whichmod = 'roman module (which is distributed with Docutils)'
hint = ('This can happen if you upgraded docutils using\n'
'easy_install without uninstalling the old version'
'first.\n')
else:
whichmod += ' module'
sys.stderr.write('Error: The %s cannot be found. '
'Did you install Sphinx and its dependencies '
'correctly?\n' % whichmod)
if hint:
sys.stderr.write(hint)
return 1
raise
return cmdline.main(argv)
if __name__ == '__main__':
sys.exit(main(sys.argv))
|