00001 # -*- coding: utf-8 -*- 00002 # 00003 # SfePy documentation build configuration file, created by 00004 # sphinx-quickstart on Wed Oct 14 00:02:22 2009. 00005 # 00006 # This file is execfile()d with the current directory set to its containing dir. 00007 # 00008 # Note that not all possible configuration values are present in this 00009 # autogenerated file. 00010 # 00011 # All configuration values have a default; values that are commented out 00012 # serve to show the default. 00013 00014 import sys, os 00015 00016 # If extensions (or modules to document with autodoc) are in another directory, 00017 # add these directories to sys.path here. If the directory is relative to the 00018 # documentation root, use os.path.abspath to make it absolute, like shown here. 00019 #sys.path.append(os.path.abspath('.')) 00020 00021 ## LS: Below walks parent directory and adds all non-excluded to sys.path 00022 #def add_to_sys_path(arg, dirname, fnames): 00023 # excludes = ('.git',) 00024 # for exclude in excludes: 00025 # if exclude not in dirname: 00026 # sys.path.append(os.path.abspath(dirname)) 00027 # 00028 #doc_dir,conf_file = os.path.split(__file__) 00029 #sfepy_dir = os.path.abspath(os.path.join(doc_dir, os.path.pardir)) 00030 #os.path.walk(sfepy_dir, add_to_sys_path, None) 00031 sys.path.append(os.path.abspath('sphinxext')) 00032 00033 import sfepy 00034 sys.path.append(os.path.abspath('../script')) 00035 from config import Config 00036 00037 numpydoc_path = Config().numpydoc_path() 00038 00039 if numpydoc_path is not None: 00040 sys.path.append(os.path.abspath(numpydoc_path)) 00041 00042 import gen_term_table 00043 gen_term_table.typeset('term_table.rst') 00044 00045 # -- General configuration ----------------------------------------------------- 00046 00047 # Add any Sphinx extension module names here, as strings. They can be extensions 00048 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. 00049 extensions = ['sphinx.ext.autosummary', 'sphinx.ext.autodoc', 00050 'sphinx.ext.doctest', 'sphinx.ext.pngmath', 00051 'sphinx.ext.viewcode', 'numpydoc', 00052 'ipython_console_highlighting'] 00053 #extensions = ['sphinx.ext.autodoc'] 00054 00055 # Add any paths that contain templates here, relative to this directory. 00056 templates_path = ['_templates'] 00057 00058 # The suffix of source filenames. 00059 source_suffix = '.rst' 00060 00061 # The encoding of source files. 00062 #source_encoding = 'utf-8' 00063 00064 # The master toctree document. 00065 master_doc = 'index' 00066 00067 # General information about the project. 00068 project = u'SfePy' 00069 copyright = u'2010, Robert Cimrman and Contributors' 00070 00071 # The version info for the project you're documenting, acts as replacement for 00072 # |version| and |release|, also used in various other places throughout the 00073 # built documents. 00074 # 00075 # The short X.Y version. 00076 version = sfepy.__version__.split('-')[0] 00077 # The full version, including alpha/beta/rc tags. 00078 release = version 00079 00080 # The language for content autogenerated by Sphinx. Refer to documentation 00081 # for a list of supported languages. 00082 #language = None 00083 00084 # There are two options for replacing |today|: either, you set today to some 00085 # non-false value, then it is used: 00086 #today = '' 00087 # Else, today_fmt is used as the format for a strftime call. 00088 today_fmt = '%B %d, %Y' 00089 00090 # List of documents that shouldn't be included in the build. 00091 #unused_docs = [] 00092 00093 # List of directories, relative to source directory, that shouldn't be searched 00094 # for source files. 00095 exclude_trees = ['_build'] 00096 00097 # The reST default role (used for this markup: `text`) to use for all documents. 00098 #default_role = None 00099 00100 # If true, '()' will be appended to :func: etc. cross-reference text. 00101 #add_function_parentheses = True 00102 00103 # If true, the current module name will be prepended to all description 00104 # unit titles (such as .. function::). 00105 add_module_names = True 00106 00107 # If true, sectionauthor and moduleauthor directives will be shown in the 00108 # output. They are ignored by default. 00109 show_authors = True 00110 00111 # The name of the Pygments (syntax highlighting) style to use. 00112 pygments_style = 'sphinx' 00113 00114 # A list of ignored prefixes for module index sorting. 00115 #modindex_common_prefix = [] 00116 00117 00118 # -- Options for HTML output --------------------------------------------------- 00119 00120 # The theme to use for HTML and HTML Help pages. Major themes that come with 00121 # Sphinx are currently 'default' and 'sphinxdoc'. 00122 html_theme = 'default' 00123 00124 # Theme options are theme-specific and customize the look and feel of a theme 00125 # further. For a list of options available for each theme, see the 00126 # documentation. 00127 #html_theme_options = {} 00128 00129 # Add any paths that contain custom themes here, relative to this directory. 00130 #html_theme_path = [] 00131 00132 # The name for this set of Sphinx documents. If None, it defaults to 00133 # "<project> v<release> documentation". 00134 #html_title = None 00135 00136 # A shorter title for the navigation bar. Default is the same as html_title. 00137 #html_short_title = None 00138 00139 # The name of an image file (relative to this directory) to place at the top 00140 # of the sidebar. 00141 #html_logo = None 00142 00143 # The name of an image file (within the static path) to use as favicon of the 00144 # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 00145 # pixels large. 00146 #html_favicon = None 00147 00148 # Add any paths that contain custom static files (such as style sheets) here, 00149 # relative to this directory. They are copied after the builtin static files, 00150 # so a file named "default.css" will overwrite the builtin "default.css". 00151 html_static_path = ['_static'] 00152 00153 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, 00154 # using the given strftime format. 00155 html_last_updated_fmt = '%b %d, %Y' 00156 00157 # If true, SmartyPants will be used to convert quotes and dashes to 00158 # typographically correct entities. 00159 html_use_smartypants = True 00160 00161 # Custom sidebar templates, maps document names to template names. 00162 #html_sidebars = {} 00163 00164 # Additional templates that should be rendered to pages, maps page names to 00165 # template names. 00166 #html_additional_pages = {} 00167 00168 # If false, no module index is generated. 00169 html_use_modindex = True 00170 00171 # If false, no index is generated. 00172 html_use_index = True 00173 00174 # If true, the index is split into individual pages for each letter. 00175 html_split_index = True 00176 00177 # If true, links to the reST sources are added to the pages. 00178 #html_show_sourcelink = True 00179 00180 # If true, an OpenSearch description file will be output, and all pages will 00181 # contain a <link> tag referring to it. The value of this option must be the 00182 # base URL from which the finished HTML is served. 00183 html_use_opensearch = '../objects.inv' 00184 00185 # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). 00186 #html_file_suffix = '' 00187 00188 # Output file base name for HTML help builder. 00189 htmlhelp_basename = 'SfePydoc' 00190 00191 00192 # -- Options for LaTeX output -------------------------------------------------- 00193 00194 # The paper size ('letter' or 'a4'). 00195 latex_paper_size = 'a4' 00196 00197 # The font size ('10pt', '11pt' or '12pt'). 00198 latex_font_size = '12pt' 00199 00200 # Grouping the document tree into LaTeX files. List of tuples 00201 # (source start file, target name, title, author, documentclass [howto/manual]). 00202 latex_documents = [ 00203 ('index', 'SfePy.tex', u'SfePy Documentation', 00204 u'Robert Cimrman and Contributors', 'manual'), 00205 ] 00206 00207 # The name of an image file (relative to this directory) to place at the top of 00208 # the title page. 00209 #latex_logo = None 00210 00211 # For "manual" documents, if this is true, then toplevel headings are parts, 00212 # not chapters. 00213 #latex_use_parts = False 00214 00215 # Additional stuff for the LaTeX preamble. 00216 #latex_preamble = '' 00217 latex_preamble = r""" 00218 \usepackage{bm} 00219 \def\dt{{\Delta t}} 00220 \def\pdiff#1#2{\frac{\partial {#1}}{\partial {#2}}} 00221 \def\tdiff#1#2{\frac{{\rm d} {#1}}{{\rm d} {#2}}} 00222 \def\difd#1{\ {\rm d}#1} 00223 \newcommand{\dvg}{\mathop{\rm div}} 00224 \newcommand{\tr}{\mathop{\rm tr}} 00225 \newcommand{\ul}[1]{\underline{#1}} 00226 \newcommand{\uld}[1]{\dot{\underline{#1}}} 00227 \newcommand{\ull}[1]{\underline{\underline{#1}}} 00228 \newcommand{\dev}{\mathop{\rm dev}} 00229 \newcommand{\skewop}{\mathop{\rm skew}} 00230 \def\from{\leftarrow} 00231 \def\Vcal{\mathcal{V}} 00232 \def\Tcal{\mathcal{T}} 00233 \def\Ical{\mathcal{I}} 00234 \def\Hcal{\mathcal{H}} 00235 \def\Fcal{\mathcal{F}} 00236 \def\Gcal{\mathcal{G}} 00237 \def\pd{\partial} 00238 \def\ub{\bm{u}} 00239 \def\vb{\bm{v}} 00240 \def\Mb{\bm{M}} 00241 \def\vphib{\bm{\varphi}} 00242 """ 00243 # LS: Are the following needed as well? 00244 #\def\Vcal{\mathcal{V}} 00245 #\def\Tcal{\mathcal{T}} 00246 #\def\figDir{../doc/tex/figures} 00247 #""" 00248 00249 # Documents to append as an appendix to all manuals. 00250 #latex_appendices = [] 00251 00252 # If false, no module index is generated. 00253 latex_use_modindex = True 00254 00255 # Preamble for pngmath images 00256 pngmath_latex_preamble = latex_preamble 00257 00258 # Turn off numpydoc autosummary tables 00259 numpydoc_show_class_members = False 00260 00261 def process_terms(app, what_, name, obj, options, lines): 00262 """ 00263 Prepend term call signature(s) into term docstrings. 00264 """ 00265 from types import TypeType 00266 from sfepy.terms import Term 00267 00268 if isinstance(obj, TypeType): 00269 if issubclass(obj, Term) and len(obj.name): 00270 arg_types = obj.arg_types 00271 if ((len(arg_types) > 1) and not isinstance(arg_types[0], str)): 00272 arg_types = [', '.join(['%s' % arg for arg in arg_type]) 00273 for arg_type in arg_types] 00274 at_lines = [' ``(%s)``' % arg_type for arg_type in arg_types] 00275 00276 else: 00277 arg_types = ', '.join(['%s' % arg for arg in arg_types]) 00278 at_lines = [' ``(%s)``' % arg_types] 00279 00280 00281 len0 = len(obj.name) + 4 00282 lines.insert(0, ':Call signature:') 00283 lines.insert(1, ('=' * len0) + ' ===') 00284 lines.insert(2, '**%s** %s' % (obj.name, at_lines[0])) 00285 for ii, line in enumerate(at_lines[1:]): 00286 lines.insert(3+ii, '..' + (' ' * (len0 - 2)) + line) 00287 lines.insert(3+len(at_lines), ('=' * len0) + ' ===') 00288 00289 # make sure there is a blank line at the end 00290 if lines and lines[-1]: 00291 lines.append('') 00292 00293 00294 def setup(app): 00295 app.connect('autodoc-process-docstring', process_terms)