[Python-modules-commits] [sphinx] 01/06: Import sphinx_1.4.6.orig.tar.gz

Dmitry Shachnev mitya57 at moszumanska.debian.org
Tue Aug 23 19:14:36 UTC 2016


This is an automated email from the git hooks/post-receive script.

mitya57 pushed a commit to branch master
in repository sphinx.

commit d93d63b6891f83ddf7a916ec518201104e51a8f0
Author: Dmitry Shachnev <mitya57 at gmail.com>
Date:   Tue Aug 23 22:12:11 2016 +0300

    Import sphinx_1.4.6.orig.tar.gz
---
 CHANGES                                            |  31 ++++
 EXAMPLES                                           |   1 +
 Makefile                                           |   1 +
 PKG-INFO                                           |   2 +-
 Sphinx.egg-info/PKG-INFO                           |   2 +-
 Sphinx.egg-info/SOURCES.txt                        |  20 ++-
 Sphinx.egg-info/requires.txt                       |   2 +-
 doc/_templates/index.html                          |   4 +-
 doc/_themes/sphinx13/layout.html                   |   4 +-
 doc/conf.py                                        |   9 +-
 doc/config.rst                                     |   4 +
 doc/domains.rst                                    |   8 +-
 doc/ext/example_google.rst                         |   4 +-
 doc/ext/example_numpy.rst                          |   4 +-
 doc/markup/inline.rst                              |   6 +
 setup.py                                           |   2 +-
 sphinx/__init__.py                                 |   6 +-
 sphinx/application.py                              |   2 +-
 sphinx/builders/applehelp.py                       |  42 +++---
 sphinx/builders/epub.py                            |  22 ++-
 sphinx/builders/epub3.py                           |  79 ++++++-----
 sphinx/builders/html.py                            |  22 +++
 sphinx/builders/linkcheck.py                       |   5 +
 sphinx/config.py                                   |  11 +-
 sphinx/directives/code.py                          |  17 ++-
 sphinx/domains/__init__.py                         |   4 +-
 sphinx/ext/autodoc.py                              |   7 +-
 sphinx/ext/intersphinx.py                          |  12 +-
 sphinx/make_mode.py                                |   5 +-
 sphinx/pycode/Grammar-py2-sphinx1.5.pickle         | Bin 18705 -> 0 bytes
 sphinx/pycode/Grammar-py3-sphinx1.5.pickle         | Bin 19546 -> 0 bytes
 sphinx/themes/basic/changes/frameset.html          |   2 +-
 sphinx/themes/basic/changes/rstsource.html         |   2 +-
 sphinx/themes/basic/changes/versionchanges.html    |   2 +-
 sphinx/themes/basic/domainindex.html               |   4 +-
 sphinx/themes/basic/layout.html                    |   8 +-
 sphinx/themes/epub/layout.html                     |   3 +-
 sphinx/util/inspect.py                             |   8 +-
 sphinx/util/osutil.py                              |   7 +
 sphinx/util/pycompat.py                            |   2 +-
 sphinx/util/smartypants.py                         |   4 +-
 sphinx/writers/html.py                             |  17 ++-
 tests/.test_build_latex.py.swp                     | Bin 53248 -> 0 bytes
 tests/root/footnote.txt                            |   6 -
 tests/root/images.txt                              |   3 -
 tests/root/includes.txt                            |   4 -
 tests/root/markup.txt                              |  15 --
 tests/roots/test-basic/conf.py                     |   7 +
 tests/roots/test-basic/index.rst                   |  29 ++++
 tests/roots/test-ext-math-simple/conf.py           |   6 +
 tests/roots/test-ext-math-simple/index.rst         |   4 +
 tests/roots/test-ext-math/math.rst                 |  31 ++++
 tests/roots/test-searchadapters/conf.py            |   4 +
 .../{root => roots/test-searchadapters}/markup.txt |   0
 tests/roots/test-warnings/autodoc_fodder.py        |   7 +
 tests/roots/test-warnings/conf.py                  |  12 ++
 tests/roots/test-warnings/index.rst                |  48 +++++++
 tests/roots/test-warnings/svgimg.pdf               | Bin 0 -> 141783 bytes
 tests/roots/test-warnings/svgimg.svg               | 158 +++++++++++++++++++++
 .../test-warnings/undecodable.rst}                 |   0
 tests/roots/test-warnings/wrongenc.inc             |   3 +
 tests/test_autodoc.py                              |   5 +-
 tests/test_build.py                                |  13 +-
 tests/test_build_applehelp.py                      |   6 +-
 tests/test_build_html.py                           | 149 ++++++++++++++-----
 tests/test_build_latex.py                          |  39 +++--
 tests/test_build_texinfo.py                        |  30 ++--
 tests/test_environment.py                          |   5 -
 tests/test_ext_autosummary.py                      |   2 +-
 tests/test_ext_ifconfig.py                         |   5 +-
 tests/test_ext_intersphinx.py                      |  46 +++++-
 tests/test_ext_math.py                             |  20 ++-
 tests/test_i18n.py                                 |  17 ---
 tests/test_markup.py                               |   2 +-
 tests/test_searchadapters.py                       |   2 +-
 tests/test_util_inspect.py                         |  70 +++++++++
 tests/typing_test_data.py                          |   8 ++
 77 files changed, 893 insertions(+), 260 deletions(-)

diff --git a/CHANGES b/CHANGES
index 531d7c3..d50bbbf 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,33 @@
+Release 1.4.6 (released Aug 20, 2016)
+=====================================
+
+Incompatible changes
+--------------------
+
+* #2867: linkcheck builder crashes with six-1.4.  Now Sphinx depends on six-1.5 or
+  later
+
+Bugs fixed
+----------
+
+* applehelp: Sphinx crashes if ``hiutil`` or ``codesign`` commands not found
+* Fix ``make clean`` abort issue when build dir contains regular files like ``DS_Store``.
+* Reduce epubcheck warnings/errors:
+
+  * Fix DOCTYPE to html5
+  * Change extension from .html to .xhtml.
+  * Disable search page on epub results
+
+* #2778: Fix autodoc crashes if obj.__dict__ is a property method and raises exception
+* Fix duplicated toc in epub3 output.
+* #2775: Fix failing linkcheck with servers not supporting identidy encoding
+* #2833: Fix formatting instance annotations in ext.autodoc.
+* #1911: ``-D`` option of ``sphinx-build`` does not override the ``extensions`` variable
+* #2789: `sphinx.ext.intersphinx` generates wrong hyperlinks if the inventory is given
+* parsing errors for caption of code-blocks are displayed in document (ref: #2845)
+* #2846: ``singlehtml`` builder does not include figure numbers
+* #2816: Fix data from builds cluttering the ``Domain.initial_data`` class attributes
+
 Release 1.4.5 (released Jul 13, 2016)
 =====================================
 
@@ -50,6 +80,7 @@ Bugs fixed
 * #2763: (html) Provide default value for required ``alt`` attribute for image
   tags of SVG source, required to validate and now consistent w/ other formats.
 
+
 Release 1.4.4 (released Jun 12, 2016)
 =====================================
 
diff --git a/EXAMPLES b/EXAMPLES
index e6d7ced..e5d27f7 100644
--- a/EXAMPLES
+++ b/EXAMPLES
@@ -61,6 +61,7 @@ Documentation using the classic theme
 * Quex: http://quex.sourceforge.net/doc/html/main.html
 * Ring programming language: http://ring-lang.sourceforge.net/doc/index.html
 * Scapy: http://www.secdev.org/projects/scapy/doc/
+* Seaborn: https://stanford.edu/~mwaskom/software/seaborn/
 * Segway: http://noble.gs.washington.edu/proj/segway/doc/1.1.0/segway.html
 * SimPy: http://simpy.readthedocs.org/en/latest/
 * SymPy: http://docs.sympy.org/
diff --git a/Makefile b/Makefile
index 3b95810..adaf964 100644
--- a/Makefile
+++ b/Makefile
@@ -9,6 +9,7 @@ DONT_CHECK = -i build -i dist -i sphinx/style/jquery.js \
              -i tests/coverage.py -i env -i utils/convert.py \
              -i tests/typing_test_data.py \
              -i tests/test_autodoc_py35.py \
+             -i tests/roots/test-warnings/undecodable.rst \
              -i tests/build \
              -i sphinx/search/da.py \
              -i sphinx/search/de.py \
diff --git a/PKG-INFO b/PKG-INFO
index 22132c5..9f5b717 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: Sphinx
-Version: 1.4.5
+Version: 1.4.6
 Summary: Python documentation generator
 Home-page: http://sphinx-doc.org/
 Author: Georg Brandl
diff --git a/Sphinx.egg-info/PKG-INFO b/Sphinx.egg-info/PKG-INFO
index 22132c5..9f5b717 100644
--- a/Sphinx.egg-info/PKG-INFO
+++ b/Sphinx.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: Sphinx
-Version: 1.4.5
+Version: 1.4.6
 Summary: Python documentation generator
 Home-page: http://sphinx-doc.org/
 Author: Georg Brandl
diff --git a/Sphinx.egg-info/SOURCES.txt b/Sphinx.egg-info/SOURCES.txt
index 66ef5db..84b4b9e 100644
--- a/Sphinx.egg-info/SOURCES.txt
+++ b/Sphinx.egg-info/SOURCES.txt
@@ -331,10 +331,8 @@ sphinx/locale/zh_CN/LC_MESSAGES/sphinx.po
 sphinx/locale/zh_TW/LC_MESSAGES/sphinx.js
 sphinx/locale/zh_TW/LC_MESSAGES/sphinx.mo
 sphinx/locale/zh_TW/LC_MESSAGES/sphinx.po
-sphinx/pycode/Grammar-py2-sphinx1.5.pickle
 sphinx/pycode/Grammar-py2.pickle
 sphinx/pycode/Grammar-py2.txt
-sphinx/pycode/Grammar-py3-sphinx1.5.pickle
 sphinx/pycode/Grammar-py3.pickle
 sphinx/pycode/Grammar-py3.txt
 sphinx/pycode/__init__.py
@@ -533,7 +531,6 @@ sphinx/writers/texinfo.py
 sphinx/writers/text.py
 sphinx/writers/websupport.py
 sphinx/writers/xml.py
-tests/.test_build_latex.py.swp
 tests/coverage.py
 tests/path.py
 tests/run.py
@@ -576,7 +573,6 @@ tests/test_ext_napoleon_docstring.py
 tests/test_ext_napoleon_iterators.py
 tests/test_ext_viewcode.py
 tests/test_highlighting.py
-tests/test_i18n.py
 tests/test_intl.py
 tests/test_markup.py
 tests/test_metadata.py
@@ -589,6 +585,7 @@ tests/test_theming.py
 tests/test_toctree.py
 tests/test_util.py
 tests/test_util_i18n.py
+tests/test_util_inspect.py
 tests/test_util_jsdump.py
 tests/test_util_logging.py
 tests/test_util_nodes.py
@@ -636,7 +633,6 @@ tests/root/svgimg.svg
 tests/root/tabs.inc
 tests/root/templated.css_t
 tests/root/test.inc
-tests/root/undecodable.txt
 tests/root/wrongenc.inc
 tests/root/ziptheme.zip
 tests/root/_static/README
@@ -674,6 +670,8 @@ tests/roots/test-autosummary/conf.py
 tests/roots/test-autosummary/contents.rst
 tests/roots/test-autosummary/dummy_module.py
 tests/roots/test-autosummary/sphinx.rst
+tests/roots/test-basic/conf.py
+tests/roots/test-basic/index.rst
 tests/roots/test-build-text/conf.py
 tests/roots/test-build-text/contents.txt
 tests/roots/test-build-text/lineblock.txt
@@ -734,6 +732,9 @@ tests/roots/test-ext-inheritance_diagram/index.rst
 tests/roots/test-ext-inheritance_diagram/test.py
 tests/roots/test-ext-math/conf.py
 tests/roots/test-ext-math/index.rst
+tests/roots/test-ext-math/math.rst
+tests/roots/test-ext-math-simple/conf.py
+tests/roots/test-ext-math-simple/index.rst
 tests/roots/test-ext-viewcode/conf.py
 tests/roots/test-ext-viewcode/index.rst
 tests/roots/test-ext-viewcode/objects.rst
@@ -841,6 +842,8 @@ tests/roots/test-prolog/index.rst
 tests/roots/test-prolog/markdown.md
 tests/roots/test-prolog/prolog_markdown_parser.py
 tests/roots/test-prolog/restructuredtext.rst
+tests/roots/test-searchadapters/conf.py
+tests/roots/test-searchadapters/markup.txt
 tests/roots/test-setup/setup.cfg
 tests/roots/test-setup/setup.py
 tests/roots/test-setup/doc/conf.py
@@ -889,6 +892,13 @@ tests/roots/test-versioning/insert_beginning.txt
 tests/roots/test-versioning/insert_similar.txt
 tests/roots/test-versioning/modified.txt
 tests/roots/test-versioning/original.txt
+tests/roots/test-warnings/autodoc_fodder.py
+tests/roots/test-warnings/conf.py
+tests/roots/test-warnings/index.rst
+tests/roots/test-warnings/svgimg.pdf
+tests/roots/test-warnings/svgimg.svg
+tests/roots/test-warnings/undecodable.rst
+tests/roots/test-warnings/wrongenc.inc
 utils/check_sources.py
 utils/pylintrc
 utils/reindent.py
diff --git a/Sphinx.egg-info/requires.txt b/Sphinx.egg-info/requires.txt
index d4d0a62..54a7ef2 100644
--- a/Sphinx.egg-info/requires.txt
+++ b/Sphinx.egg-info/requires.txt
@@ -1,4 +1,4 @@
-six>=1.4
+six>=1.5
 Jinja2>=2.3
 Pygments>=2.0
 docutils>=0.11
diff --git a/doc/_templates/index.html b/doc/_templates/index.html
index 30373f0..e0a8ce6 100644
--- a/doc/_templates/index.html
+++ b/doc/_templates/index.html
@@ -5,8 +5,8 @@
 
   <div class="quotebar">
     <p><em>{%trans%}What users say:{%endtrans%}</em></p>
-    <p>{%trans%}“Cheers for a great tool that actually makes programmers <b>want</b>
-      to write documentation!”{%endtrans%}</p>
+    <p>{%trans%}“Cheers for a great tool that actually makes programmers <b>want</b>
+      to write documentation!“{%endtrans%}</p>
   </div>
 
   <p>{%trans%}
diff --git a/doc/_themes/sphinx13/layout.html b/doc/_themes/sphinx13/layout.html
index bf28cd0..5a2a71b 100644
--- a/doc/_themes/sphinx13/layout.html
+++ b/doc/_themes/sphinx13/layout.html
@@ -57,8 +57,8 @@
 {% endblock %}
 
 {% block rootrellink %}
-        <li><a href="{{ pathto('index') }}">Sphinx home</a> |</li>
-        <li><a href="{{ pathto('contents') }}">Documentation</a> »</li>
+        <li><a href="{{ pathto('index') }}">Sphinx home</a> |</li>
+        <li><a href="{{ pathto('contents') }}">Documentation</a> »</li>
 {% endblock %}
 
 {% block header %}
diff --git a/doc/conf.py b/doc/conf.py
index 753ffab..269b672 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -36,9 +36,9 @@ epub_author = 'Georg Brandl'
 epub_publisher = 'http://sphinx-doc.org/'
 epub_scheme = 'url'
 epub_identifier = epub_publisher
-epub_pre_files = [('index.html', 'Welcome')]
-epub_post_files = [('install.html', 'Installing Sphinx'),
-                   ('develop.html', 'Sphinx development')]
+epub_pre_files = [('index.xhtml', 'Welcome')]
+epub_post_files = [('install.xhtml', 'Installing Sphinx'),
+                   ('develop.xhtml', 'Sphinx development')]
 epub_exclude_files = ['_static/opensearch.xml', '_static/doctools.js',
                       '_static/jquery.js', '_static/searchtools.js',
                       '_static/underscore.js', '_static/basic.css',
@@ -47,7 +47,8 @@ epub_fix_images = False
 epub_max_image_width = 0
 epub_show_urls = 'inline'
 epub_use_index = False
-epub_guide = (('toc', 'contents.html', u'Table of Contents'),)
+epub_guide = (('toc', 'contents.xhtml', u'Table of Contents'),)
+epub3_description = 'Sphinx documentation generator system manual'
 
 latex_documents = [('contents', 'sphinx.tex', 'Sphinx Documentation',
                     'Georg Brandl', 'manual', 1)]
diff --git a/doc/config.rst b/doc/config.rst
index b579d7e..2d42704 100644
--- a/doc/config.rst
+++ b/doc/config.rst
@@ -1388,6 +1388,10 @@ the `Dublin Core metadata <http://dublincore.org/>`_.
    a chapter, but can be confusing because it mixes entries of different
    depth in one list.  The default value is ``True``.
 
+   .. note::
+
+      ``epub3`` builder ignores ``epub_tocdup`` option(always ``False``)
+
 .. confval:: epub_tocscope
 
    This setting control the scope of the epub table of contents.  The setting
diff --git a/doc/domains.rst b/doc/domains.rst
index 2aaf218..dcecf4d 100644
--- a/doc/domains.rst
+++ b/doc/domains.rst
@@ -545,10 +545,10 @@ a visibility statement (``public``, ``private`` or ``protected``).
 
    Full and partial template specialisations can be declared::
 
-      .. cpp::class:: template<> \
+      .. cpp:class:: template<> \
                       std::array<bool, 256>
 
-      .. cpp::class:: template<typename T> \
+      .. cpp:class:: template<typename T> \
                       std::array<T, 42>
 
 
@@ -680,9 +680,9 @@ a visibility statement (``public``, ``private`` or ``protected``).
 
    Describe an enumerator, optionally with its value defined, e.g.,::
 
-      .. cpp::enumerator:: MyEnum::myEnumerator
+      .. cpp:enumerator:: MyEnum::myEnumerator
 
-      .. cpp::enumerator:: MyEnum::myOtherEnumerator = 42
+      .. cpp:enumerator:: MyEnum::myOtherEnumerator = 42
 
 
 Namespacing
diff --git a/doc/ext/example_google.rst b/doc/ext/example_google.rst
index 0650808..a06f161 100644
--- a/doc/ext/example_google.rst
+++ b/doc/ext/example_google.rst
@@ -9,7 +9,9 @@ Example Google Style Python Docstrings
 
    :ref:`example_numpy`
 
-Download: :download:`example_google.py <example_google.py>`
+.. only:: builder_html
+
+   Download: :download:`example_google.py <example_google.py>`
 
 .. literalinclude:: example_google.py
    :language: python
diff --git a/doc/ext/example_numpy.rst b/doc/ext/example_numpy.rst
index a3b4161..38d3439 100644
--- a/doc/ext/example_numpy.rst
+++ b/doc/ext/example_numpy.rst
@@ -9,7 +9,9 @@ Example NumPy Style Python Docstrings
 
    :ref:`example_google`
 
-Download: :download:`example_numpy.py <example_numpy.py>`
+.. only:: builder_html
+
+   Download: :download:`example_numpy.py <example_numpy.py>`
 
 .. literalinclude:: example_numpy.py
    :language: python
diff --git a/doc/markup/inline.rst b/doc/markup/inline.rst
index 0e825b6..ae47f82 100644
--- a/doc/markup/inline.rst
+++ b/doc/markup/inline.rst
@@ -200,6 +200,12 @@ Referencing downloadable files
    The ``example.py`` file will be copied to the output directory, and a
    suitable link generated to it.
 
+   Not to show unavailable download links, you should wrap whole paragraphs that
+   have this role::
+
+      .. only:: builder_html
+
+         See :download:`this example script <../example.py>`.
 
 Cross-referencing figures by figure number
 ------------------------------------------
diff --git a/setup.py b/setup.py
index a35c769..8611fc0 100644
--- a/setup.py
+++ b/setup.py
@@ -41,7 +41,7 @@ if sys.version_info < (2, 6) or (3, 0) <= sys.version_info < (3, 3):
     sys.exit(1)
 
 requires = [
-    'six>=1.4',
+    'six>=1.5',
     'Jinja2>=2.3',
     'Pygments>=2.0',
     'docutils>=0.11',
diff --git a/sphinx/__init__.py b/sphinx/__init__.py
index ae5c11f..ddb5f49 100644
--- a/sphinx/__init__.py
+++ b/sphinx/__init__.py
@@ -15,13 +15,13 @@
 import sys
 from os import path
 
-__version__  = '1.4.5'
-__released__ = '1.4.5'  # used when Sphinx builds its own docs
+__version__  = '1.4.6'
+__released__ = '1.4.6'  # used when Sphinx builds its own docs
 
 # version info for better programmatic use
 # possible values for 3rd element: 'alpha', 'beta', 'rc', 'final'
 # 'final' has 0 as the last element
-version_info = (1, 4, 5, 'final', 0)
+version_info = (1, 4, 6, 'final', 0)
 
 package_dir = path.abspath(path.dirname(__file__))
 
diff --git a/sphinx/application.py b/sphinx/application.py
index 5fa0182..e741e3c 100644
--- a/sphinx/application.py
+++ b/sphinx/application.py
@@ -37,7 +37,7 @@ from sphinx.domains.std import GenericObject, Target, StandardDomain
 from sphinx.builders import BUILTIN_BUILDERS
 from sphinx.environment import BuildEnvironment
 from sphinx.io import SphinxStandaloneReader
-from sphinx.util import pycompat  # noqa: imported for side-effects
+from sphinx.util import pycompat  # noqa: F401
 from sphinx.util import import_object
 from sphinx.util.tags import Tags
 from sphinx.util.osutil import ENOENT
diff --git a/sphinx/builders/applehelp.py b/sphinx/builders/applehelp.py
index ee5c1ad..a6c89b6 100644
--- a/sphinx/builders/applehelp.py
+++ b/sphinx/builders/applehelp.py
@@ -217,16 +217,19 @@ class AppleHelpBuilder(StandaloneHTMLBuilder):
             self.warn('you will need to index this help book with:\n  %s'
                       % (' '.join([pipes.quote(arg) for arg in args])))
         else:
-            p = subprocess.Popen(args,
-                                 stdout=subprocess.PIPE,
-                                 stderr=subprocess.STDOUT)
+            try:
+                p = subprocess.Popen(args,
+                                     stdout=subprocess.PIPE,
+                                     stderr=subprocess.STDOUT)
 
-            output = p.communicate()[0]
+                output = p.communicate()[0]
 
-            if p.returncode != 0:
-                raise AppleHelpIndexerFailed(output)
-            else:
-                self.info('done')
+                if p.returncode != 0:
+                    raise AppleHelpIndexerFailed(output)
+                else:
+                    self.info('done')
+            except OSError:
+                raise AppleHelpIndexerFailed('Command not found: %s' % args[0])
 
         # If we've been asked to, sign the bundle
         if self.config.applehelp_codesign_identity:
@@ -248,13 +251,16 @@ class AppleHelpBuilder(StandaloneHTMLBuilder):
                 self.warn('you will need to sign this help book with:\n  %s'
                           % (' '.join([pipes.quote(arg) for arg in args])))
             else:
-                p = subprocess.Popen(args,
-                                     stdout=subprocess.PIPE,
-                                     stderr=subprocess.STDOUT)
-
-                output = p.communicate()[0]
-
-                if p.returncode != 0:
-                    raise AppleHelpCodeSigningFailed(output)
-                else:
-                    self.info('done')
+                try:
+                    p = subprocess.Popen(args,
+                                         stdout=subprocess.PIPE,
+                                         stderr=subprocess.STDOUT)
+
+                    output = p.communicate()[0]
+
+                    if p.returncode != 0:
+                        raise AppleHelpCodeSigningFailed(output)
+                    else:
+                        self.info('done')
+                except OSError:
+                    raise AppleHelpCodeSigningFailed('Command not found: %s' % args[0])
diff --git a/sphinx/builders/epub.py b/sphinx/builders/epub.py
index faa587a..f5f0d80 100644
--- a/sphinx/builders/epub.py
+++ b/sphinx/builders/epub.py
@@ -15,6 +15,7 @@ import re
 import codecs
 import zipfile
 from os import path
+from datetime import datetime
 
 try:
     from PIL import Image
@@ -28,7 +29,6 @@ from docutils import nodes
 
 from sphinx import addnodes
 from sphinx.builders.html import StandaloneHTMLBuilder
-from sphinx.util.i18n import format_date
 from sphinx.util.osutil import ensuredir, copyfile, EEXIST
 from sphinx.util.smartypants import sphinx_smarty_pants as ssp
 from sphinx.util.console import brown
@@ -113,7 +113,7 @@ COVER_TEMPLATE = u'''\
     <meta name="cover" content="%(cover)s"/>
 '''
 
-COVERPAGE_NAME = u'epub-cover.html'
+COVERPAGE_NAME = u'epub-cover.xhtml'
 
 FILE_TEMPLATE = u'''\
     <item id="%(id)s"
@@ -128,6 +128,9 @@ GUIDE_TEMPLATE = u'''\
 
 TOCTREE_TEMPLATE = u'toctree-l%d'
 
+DOCTYPE = u'''<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+  "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">'''
+
 LINK_TARGET_TEMPLATE = u' [%(uri)s]'
 
 FOOTNOTE_LABEL_TEMPLATE = u'#%d'
@@ -143,7 +146,7 @@ GUIDE_TITLES = {
 }
 
 MEDIA_TYPES = {
-    '.html': 'application/xhtml+xml',
+    '.xhtml': 'application/xhtml+xml',
     '.css': 'text/css',
     '.png': 'image/png',
     '.gif': 'image/gif',
@@ -185,6 +188,9 @@ class EpubBuilder(StandaloneHTMLBuilder):
     # don't add sidebar etc.
     embedded = True
 
+    # don't generate search index or include search page
+    search = False
+
     mimetype_template = MIMETYPE_TEMPLATE
     container_template = CONTAINER_TEMPLATE
     toc_template = TOC_TEMPLATE
@@ -198,6 +204,7 @@ class EpubBuilder(StandaloneHTMLBuilder):
     spine_template = SPINE_TEMPLATE
     guide_template = GUIDE_TEMPLATE
     toctree_template = TOCTREE_TEMPLATE
+    doctype = DOCTYPE
     link_target_template = LINK_TARGET_TEMPLATE
     css_link_target_class = CSS_LINK_TARGET_CLASS
     guide_titles = GUIDE_TITLES
@@ -207,7 +214,8 @@ class EpubBuilder(StandaloneHTMLBuilder):
     def init(self):
         StandaloneHTMLBuilder.init(self)
         # the output files for epub must be .html only
-        self.out_suffix = '.html'
+        self.out_suffix = '.xhtml'
+        self.link_suffix = '.xhtml'
         self.playorder = 0
         self.tocid = 0
 
@@ -277,7 +285,7 @@ class EpubBuilder(StandaloneHTMLBuilder):
         """
         refnodes.insert(0, {
             'level': 1,
-            'refuri': self.esc(self.config.master_doc + '.html'),
+            'refuri': self.esc(self.config.master_doc + self.out_suffix),
             'text': ssp(self.esc(
                 self.env.titles[self.config.master_doc].astext()))
         })
@@ -481,6 +489,7 @@ class EpubBuilder(StandaloneHTMLBuilder):
         """
         if pagename.startswith('genindex'):
             self.fix_genindex(addctx['genindexentries'])
+        addctx['doctype'] = self.doctype
         StandaloneHTMLBuilder.handle_page(self, pagename, addctx, templatename,
                                           outfilename, event_arg)
 
@@ -531,8 +540,7 @@ class EpubBuilder(StandaloneHTMLBuilder):
         metadata['copyright'] = self.esc(self.config.epub_copyright)
         metadata['scheme'] = self.esc(self.config.epub_scheme)
         metadata['id'] = self.esc(self.config.epub_identifier)
-        metadata['date'] = self.esc(format_date('%Y-%m-%d', language=self.config.language,
-                                                warn=self.warn))
+        metadata['date'] = self.esc(datetime.utcnow().strftime("%Y-%m-%d"))
         metadata['files'] = files
         metadata['spine'] = spine
         metadata['guide'] = guide
diff --git a/sphinx/builders/epub3.py b/sphinx/builders/epub3.py
index 0fd3477..d792bd6 100644
--- a/sphinx/builders/epub3.py
+++ b/sphinx/builders/epub3.py
@@ -12,6 +12,7 @@
 
 import codecs
 from os import path
+from datetime import datetime
 
 from sphinx.builders.epub import EpubBuilder
 
@@ -41,13 +42,12 @@ NAVIGATION_DOC_TEMPLATE = u'''\
 </html>
 '''
 
-NAVLIST_TEMPLATE = u'''\
-%(indent)s  <li>
-%(indent)s    <a href="%(refuri)s">%(text)s</a>
-%(indent)s  </li>
-'''
-NAVLIST_INDENT = '      '
-
+NAVLIST_TEMPLATE = u'''%(indent)s      <li><a href="%(refuri)s">%(text)s</a></li>'''
+NAVLIST_TEMPLATE_HAS_CHILD = u'''%(indent)s      <li><a href="%(refuri)s">%(text)s</a>'''
+NAVLIST_TEMPLATE_BEGIN_BLOCK = u'''%(indent)s        <ol>'''
+NAVLIST_TEMPLATE_END_BLOCK = u'''%(indent)s        </ol>
+%(indent)s      </li>'''
+NAVLIST_INDENT = '  '
 
 PACKAGE_DOC_TEMPLATE = u'''\
 <?xml version="1.0" encoding="UTF-8"?>
@@ -73,7 +73,6 @@ PACKAGE_DOC_TEMPLATE = u'''\
 %(files)s
   </manifest>
   <spine toc="ncx" page-progression-direction="%(page_progression_direction)s">
-    <itemref idref="nav" />
 %(spine)s
   </spine>
   <guide>
@@ -82,6 +81,8 @@ PACKAGE_DOC_TEMPLATE = u'''\
 </package>
 '''
 
+DOCTYPE = u'''<!DOCTYPE html>'''
+
 # The epub3 publisher
 
 
@@ -97,8 +98,12 @@ class Epub3Builder(EpubBuilder):
 
     navigation_doc_template = NAVIGATION_DOC_TEMPLATE
     navlist_template = NAVLIST_TEMPLATE
+    navlist_template_has_child = NAVLIST_TEMPLATE_HAS_CHILD
+    navlist_template_begin_block = NAVLIST_TEMPLATE_BEGIN_BLOCK
+    navlist_template_end_block = NAVLIST_TEMPLATE_END_BLOCK
     navlist_indent = NAVLIST_INDENT
     content_template = PACKAGE_DOC_TEMPLATE
+    doctype = DOCTYPE
 
     # Finish by building the epub file
     def handle_finish(self):
@@ -121,15 +126,26 @@ class Epub3Builder(EpubBuilder):
         metadata['contributor'] = self.esc(self.config.epub3_contributor)
         metadata['page_progression_direction'] = self.esc(
             self.config.epub3_page_progression_direction) or 'default'
+        metadata['date'] = self.esc(datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ"))
         return metadata
 
-    def new_navlist(self, node, level):
+    def new_navlist(self, node, level, has_child):
         """Create a new entry in the toc from the node at given level."""
         # XXX Modifies the node
         self.tocid += 1
         node['indent'] = self.navlist_indent * level
-        navpoint = self.navlist_template % node
-        return navpoint
+        if has_child:
+            return self.navlist_template_has_child % node
+        else:
+            return self.navlist_template % node
+
+    def begin_navlist_block(self, level):
+        return self.navlist_template_begin_block % {
+            "indent": self.navlist_indent * level
+        }
+
+    def end_navlist_block(self, level):
+        return self.navlist_template_end_block % {"indent": self.navlist_indent * level}
 
     def build_navlist(self, nodes):
         """Create the toc navigation structure.
@@ -141,10 +157,9 @@ class Epub3Builder(EpubBuilder):
         The difference from build_navpoints method is templates which are used
         when generating navigation documents.
         """
-        navstack = []
         navlist = []
         level = 1
-        lastnode = None
+        usenodes = []
         for node in nodes:
             if not node['text']:
                 continue
@@ -153,30 +168,23 @@ class Epub3Builder(EpubBuilder):
                 continue
             if node['level'] > self.config.epub_tocdepth:
                 continue
-            if node['level'] == level:
-                navlist.append(self.new_navlist(node, level))
-            elif node['level'] == level + 1:
-                navstack.append(navlist)
-                navlist = []
-                level += 1
-                if lastnode and self.config.epub_tocdup:
-                    navlist.append(self.new_navlist(node, level))
-                    navlist[-1] = '<ol>\n' + navlist[-1]
+            usenodes.append(node)
+        for i, node in enumerate(usenodes):
+            curlevel = node['level']
+            if curlevel == level + 1:
+                navlist.append(self.begin_navlist_block(level))
+            while curlevel < level:
+                level -= 1
+                navlist.append(self.end_navlist_block(level))
+            level = curlevel
+            if i != len(usenodes) - 1 and usenodes[i + 1]['level'] > level:
+                has_child = True
             else:
-                while node['level'] < level:
-                    subnav = '\n'.join(navlist)
-                    navlist = navstack.pop()
-                    navlist[-1] = self.insert_subnav(navlist[-1], subnav)
-                    level -= 1
-                    navlist[-1] = navlist[-1] + '</ol>'
-                navlist.append(self.new_navlist(node, level))
-            lastnode = node
+                has_child = False
+            navlist.append(self.new_navlist(node, level, has_child))
         while level != 1:
-            subnav = '\n'.join(navlist)
-            navlist = navstack.pop()
-            navlist[-1] = self.insert_subnav(navlist[-1], subnav)
             level -= 1
-            navlist[-1] = navlist[-1] + '</ol>'
+            navlist.append(self.end_navlist_block(level))
         return '\n'.join(navlist)
 
     def navigation_doc_metadata(self, navlist):
@@ -210,4 +218,5 @@ class Epub3Builder(EpubBuilder):
         finally:
             f.close()
             # Add nav.xhtml to epub file
-            self.files.append(outname)
+            if outname not in self.files:
+                self.files.append(outname)
diff --git a/sphinx/builders/html.py b/sphinx/builders/html.py
index f541daa..e19da22 100644
--- a/sphinx/builders/html.py
+++ b/sphinx/builders/html.py
@@ -981,6 +981,26 @@ class SingleFileHTMLBuilder(StandaloneHTMLBuilder):
 
         return {self.config.master_doc: new_secnumbers}
 
+    def assemble_toc_fignumbers(self):
+        # Assemble toc_fignumbers to resolve figure numbers on SingleHTML.
+        # Merge all fignumbers to single fignumber.
+        #
+        # Note: current Sphinx has refid confliction in singlehtml mode.
+        #       To avoid the problem, it replaces key of secnumbers to
+        #       tuple of docname and refid.
+        #
+        #       There are related codes in inline_all_toctres() and
+        #       HTMLTranslter#add_fignumber().
+        new_fignumbers = {}
+        # {u'foo': {'figure': {'id2': (2,), 'id1': (1,)}}, u'bar': {'figure': {'id1': (3,)}}}
+        for docname, fignumlist in iteritems(self.env.toc_fignumbers):
+            for figtype, fignums in iteritems(fignumlist):
+                new_fignumbers.setdefault((docname, figtype), {})
+                for id, fignum in iteritems(fignums):
+                    new_fignumbers[(docname, figtype)][id] = fignum
+
+        return {self.config.master_doc: new_fignumbers}
+
     def get_doc_context(self, docname, body, metatags):
         # no relation links...
         toc = self.env.get_toctree_for(self.config.master_doc, self, False)
@@ -1017,6 +1037,7 @@ class SingleFileHTMLBuilder(StandaloneHTMLBuilder):
         self.info(bold('assembling single document... '), nonl=True)
         doctree = self.assemble_doctree()
         self.env.toc_secnumbers = self.assemble_toc_secnumbers()
+        self.env.toc_fignumbers = self.assemble_toc_fignumbers()
         self.info()
         self.info(bold('writing... '), nonl=True)
         self.write_doc_serialized(self.config.master_doc, doctree)
@@ -1069,6 +1090,7 @@ class SerializingHTMLBuilder(StandaloneHTMLBuilder):
         self.config_hash = ''
         self.tags_hash = ''
         self.imagedir = '_images'
+        self.current_docname = None
         self.theme = None       # no theme necessary
         self.templates = None   # no template bridge necessary
         self.init_translator_class()
diff --git a/sphinx/builders/linkcheck.py b/sphinx/builders/linkcheck.py
index 0533f1c..0f1716a 100644
--- a/sphinx/builders/linkcheck.py
+++ b/sphinx/builders/linkcheck.py
@@ -56,6 +56,11 @@ opener.addheaders = [('User-agent', 'Mozilla/5.0 (X11; Linux x86_64; rv:25.0) '
 
 class HeadRequest(Request):
     """Subclass of urllib2.Request that sends a HEAD request."""
+    def __init__(self, *args, **kwargs):
+        Request.__init__(self, *args, **kwargs)
+        # we do not parse the response in HEAD, so accepting anything is okay
+        self.headers['Accept-encoding'] = '*'
+
     def get_method(self):
         return 'HEAD'
 
diff --git a/sphinx/config.py b/sphinx/config.py
index 9527d9a..462e48a 100644
--- a/sphinx/config.py
+++ b/sphinx/config.py
@@ -276,11 +276,6 @@ class Config(object):
         self.overrides = overrides
         self.values = Config.config_values.copy()
         config = {}
-        if 'extensions' in overrides:  # XXX do we need this?
-            if isinstance(overrides['extensions'], string_types):
-                config['extensions'] = overrides.pop('extensions').split(',')
-            else:
-                config['extensions'] = overrides.pop('extensions')
         if dirname is not None:
             config_file = path.join(dirname, filename)
             config['__file__'] = config_file
@@ -299,6 +294,12 @@ class Config(object):
         # these two must be preinitialized because extensions can add their
         # own config values
         self.setup = config.get('setup', None)
+
+        if 'extensions' in overrides:
+            if isinstance(overrides['extensions'], string_types):
+                config['extensions'] = overrides.pop('extensions').split(',')
+            else:
+                config['extensions'] = overrides.pop('extensions')
         self.extensions = config.get('extensions', [])
 
         # correct values of copyright year that are not coherent with
diff --git a/sphinx/directives/code.py b/sphinx/directives/code.py
index fac8f64..8edfd61 100644
--- a/sphinx/directives/code.py
+++ b/sphinx/directives/code.py
@@ -18,6 +18,7 @@ from docutils.statemachine import ViewList
 from six import string_types
 
 from sphinx import addnodes
+from sphinx.locale import _
 from sphinx.util import parselinenos
 from sphinx.util.nodes import set_source_info
 
@@ -68,6 +69,8 @@ def container_wrapper(directive, literal_node, caption):
     parsed = nodes.Element()
     directive.state.nested_parse(ViewList([caption], source=''),
                                  directive.content_offset, parsed)
+    if isinstance(parsed[0], nodes.system_message):
+        raise ValueError(parsed[0])
     caption_node = nodes.caption(parsed[0].rawsource, '',
                                  *parsed[0].children)
     caption_node.source = parsed[0].source
@@ -131,7 +134,12 @@ class CodeBlock(Directive):
         caption = self.options.get('caption')
         if caption:
             self.options.setdefault('name', nodes.fully_normalize_name(caption))
-            literal = container_wrapper(self, literal, caption)
+            try:
+                literal = container_wrapper(self, literal, caption)
+            except ValueError as exc:
+                document = self.state.document
+                errmsg = _('Invalid caption: %s' % exc[0][0].astext())
+                return [document.reporter.warning(errmsg, line=self.lineno)]
 
         # literal will be note_implicit_target that is linked from caption and numref.
         # when options['name'] is provided, it should be primary ID.
@@ -337,7 +345,12 @@ class LiteralInclude(Directive):
             if not caption:
                 caption = self.arguments[0]
             self.options.setdefault('name', nodes.fully_normalize_name(caption))
-            retnode = container_wrapper(self, retnode, caption)
+            try:
+                retnode = container_wrapper(self, retnode, caption)
+            except ValueError as exc:
+                document = self.state.document
+                errmsg = _('Invalid caption: %s' % exc[0][0].astext())
+                return [document.reporter.warning(errmsg, line=self.lineno)]
 
         # retnode will be note_implicit_target that is linked from caption and numref.
         # when options['name'] is provided, it should be primary ID.
diff --git a/sphinx/domains/__init__.py b/sphinx/domains/__init__.py
index e4d397e..bee03fc 100644
--- a/sphinx/domains/__init__.py
+++ b/sphinx/domains/__init__.py
@@ -10,6 +10,8 @@
     :license: BSD, see LICENSE for details.
 """
 
+import copy
+
 from six import iteritems
 
 from sphinx.errors import SphinxError
@@ -145,7 +147,7 @@ class Domain(object):
         self.env = env
         if self.name not in env.domaindata:
             assert isinstance(self.initial_data, dict)
-            new_data = self.initial_data.copy()
+            new_data = copy.deepcopy(self.initial_data)
             new_data['version'] = self.data_version
             self.data = env.domaindata[self.name] = new_data
         else:
diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py
index 6ae0966..08bc99c 100644
--- a/sphinx/ext/autodoc.py
+++ b/sphinx/ext/autodoc.py
@@ -261,12 +261,13 @@ def format_annotation(annotation):
 
     Displaying complex types from ``typing`` relies on its private API.
     """
+    if not isinstance(annotation, type):
+        return repr(annotation)
+
     qualified_name = (annotation.__module__ + '.' + annotation.__qualname__
                       if annotation else repr(annotation))
 
-    if not isinstance(annotation, type):
-        return repr(annotation)
-    elif annotation.__module__ == 'builtins':
+    if annotation.__module__ == 'builtins':
         return annotation.__qualname__
     elif typing:
         if isinstance(annotation, typing.TypeVar):
diff --git a/sphinx/ext/intersphinx.py b/sphinx/ext/intersphinx.py
index c43b8ae..16a487e 100644
--- a/sphinx/ext/intersphinx.py
+++ b/sphinx/ext/intersphinx.py
@@ -239,12 +239,12 @@ def fetch_inventory(app, uri, inv):
         return
     try:
         if hasattr(f, 'geturl'):
-            newuri = f.geturl()
-            if newuri.endswith("/" + INVENTORY_FILENAME):
-                newuri = newuri[:-len(INVENTORY_FILENAME) - 1]
-            if uri != newuri and uri != newuri + "/":
-                app.info('intersphinx inventory has moved: %s -> %s' % (uri, newuri))
-                uri = newuri
+            newinv = f.geturl()
+            if inv != newinv:
+                app.info('intersphinx inventory has moved: %s -> %s' % (inv, newinv))
+
+                if uri in (inv, path.dirname(inv), path.dirname(inv) + '/'):
+                    uri = path.dirname(newinv)
         line = f.readline().rstrip().decode('utf-8')
         try:
             if line == '# Sphinx inventory version 1':
diff --git a/sphinx/make_mode.py b/sphinx/make_mode.py
index 67ba9e1..75c5ab8 100644
... 1455 lines suppressed ...

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/sphinx.git



More information about the Python-modules-commits mailing list