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
|
# -*- coding: utf-8 -*-
# Copyright (C) 2010, 2011 Sebastian Wiesner <lunaryorn@googlemail.com>
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation; either version 2.1 of the License, or (at your
# option) any later version.
# This library is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
# for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this library; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
from __future__ import (print_function, division, unicode_literals,
absolute_import)
import sys, os
from docutils import nodes
from docutils.parsers.rst import Directive
doc_directory = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.normpath(
os.path.join(doc_directory, os.pardir)))
import pyudev
needs_sphinx = '1.0'
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx',
'sphinxcontrib.issuetracker']
master_doc = 'index'
exclude_patterns = ['_build/*']
source_suffix = '.rst'
project = u'pyudev'
copyright = u'2010, 2011 Sebastian Wiesner'
version = '.'.join(pyudev.__version__.split('.')[:2])
release = pyudev.__version__
html_theme = 'default'
html_static_path = []
intersphinx_mapping = {'python': ('http://docs.python.org/', None),
'pyside': ('http://www.pyside.org/docs/pyside/', None)}
issuetracker = 'github'
issuetracker_project = 'lunaryorn/pyudev'
class UDevVersion(Directive):
"""
Directive to document the minimum udev version to use an attribute or
method
"""
has_content = False
required_arguments = 1
option_spec = {}
def run(self):
udevversion = self.arguments[0]
para = nodes.paragraph(udevversion, '', classes=['udevversion'])
text = 'Required udev version: {0}'.format(*self.arguments)
para.append(nodes.inline(udevversion, text, classes=['versionmodified']))
return [para]
def setup(app):
from sphinx.ext.autodoc import cut_lines
app.connect(b'autodoc-process-docstring', cut_lines(2, what=['module']))
app.add_directive('udevversion', UDevVersion)
|