From ddb7fab16da780c862af0d5fbf4b62862b1236ff Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Tue, 1 Nov 2011 08:59:53 +0100 Subject: [PATCH 01/12] Closes #805: Make the ``Sphinx.add_index_to_domain`` method work correctly. --- CHANGES | 17 +++++++++++------ sphinx/application.py | 5 ++--- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/CHANGES b/CHANGES index 9374d4385..b2ef6db3a 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,11 @@ +Release 1.1.1 (in development) +============================== + +* #805: Make the ``Sphinx.add_index_to_domain`` method work correctly. + +* #780: Fix Python 2.5 compatibility. + + Release 1.1 (Oct 9, 2011) ========================= @@ -115,13 +123,10 @@ Features added - #714: Added Korean locale. - #766: Added Estonian locale. +* Bugs fixed: -Release 1.0.9 (in development) -============================== - -* #778: Fix "hide search matches" link on pages linked by search. - -* Fix the source positions referenced by the "viewcode" extension. + - #778: Fix "hide search matches" link on pages linked by search. + - Fix the source positions referenced by the "viewcode" extension. Release 1.0.8 (Sep 23, 2011) diff --git a/sphinx/application.py b/sphinx/application.py index dec9c13c8..bfb39a70f 100644 --- a/sphinx/application.py +++ b/sphinx/application.py @@ -425,11 +425,10 @@ class Sphinx(object): raise ExtensionError('domain %s not yet registered' % domain) self.domains[domain].roles[name] = role - def add_index_to_domain(self, domain, name, localname, shortname, func): + def add_index_to_domain(self, domain, index): if domain not in self.domains: raise ExtensionError('domain %s not yet registered' % domain) - self.domains[domain].indices.append((name, localname, shortname)) - setattr(self.domains[domain], 'get_%s_index' % name, func) + self.domains[domain].indices.append(index) def add_object_type(self, directivename, rolename, indextemplate='', parse_node=None, ref_nodeclass=None, objname='', From 5d19b860e2310213a536818518b53019b1dd6980 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Tue, 1 Nov 2011 09:01:48 +0100 Subject: [PATCH 02/12] Closes #801: Make intersphinx work properly without SSL support. --- CHANGES | 2 ++ sphinx/ext/intersphinx.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index b2ef6db3a..74b638f3f 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,8 @@ Release 1.1.1 (in development) ============================== +* #801: Make intersphinx work properly without SSL support. + * #805: Make the ``Sphinx.add_index_to_domain`` method work correctly. * #780: Fix Python 2.5 compatibility. diff --git a/sphinx/ext/intersphinx.py b/sphinx/ext/intersphinx.py index ac229a669..7a1aeb401 100644 --- a/sphinx/ext/intersphinx.py +++ b/sphinx/ext/intersphinx.py @@ -42,7 +42,7 @@ handlers = [urllib2.ProxyHandler(), urllib2.HTTPRedirectHandler(), urllib2.HTTPHandler()] try: handlers.append(urllib2.HTTPSHandler) -except NameError: +except AttributeError: pass urllib2.install_opener(urllib2.build_opener(*handlers)) From 90b7372b8067359f1396f351c3a7e854cdc4e0fa Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Tue, 1 Nov 2011 09:09:50 +0100 Subject: [PATCH 03/12] Closes #797: Don't crash on a misformatted glossary. --- CHANGES | 2 ++ sphinx/domains/std.py | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 74b638f3f..fe7f6f46e 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,8 @@ Release 1.1.1 (in development) ============================== +* #797: Don't crash on a misformatted glossary. + * #801: Make intersphinx work properly without SSL support. * #805: Make the ``Sphinx.add_index_to_domain`` method work correctly. diff --git a/sphinx/domains/std.py b/sphinx/domains/std.py index 890ea10f7..1c68c449e 100644 --- a/sphinx/domains/std.py +++ b/sphinx/domains/std.py @@ -259,13 +259,23 @@ class Glossary(Directive): messages.append(self.state.reporter.system_message( 2, 'glossary terms must not be separated by empty ' 'lines', source=source, line=lineno)) - entries[-1][0].append((line, source, lineno)) + if entries: + entries[-1][0].append((line, source, lineno)) + else: + messages.append(self.state.reporter.system_message( + 2, 'glossary seems to be misformatted, check ' + 'indentation', source=source, line=lineno)) else: if not in_definition: # first line of definition, determines indentation in_definition = True indent_len = len(line) - len(line.lstrip()) - entries[-1][1].append(line[indent_len:], source, lineno) + if entries: + entries[-1][1].append(line[indent_len:], source, lineno) + else: + messages.append(self.state.reporter.system_message( + 2, 'glossary seems to be misformatted, check ' + 'indentation', source=source, line=lineno)) was_empty = False # now, parse all the entries into a big definition list From 3d3d3733e657633a103b8b09d0c36871f9698468 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Tue, 1 Nov 2011 09:13:41 +0100 Subject: [PATCH 04/12] Closes #796: use package_dir everywhere instead of __file__. --- sphinx/ext/autosummary/generate.py | 3 ++- sphinx/pycode/__init__.py | 3 ++- sphinx/websupport/__init__.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/sphinx/ext/autosummary/generate.py b/sphinx/ext/autosummary/generate.py index c1eb2ac58..de1578a26 100644 --- a/sphinx/ext/autosummary/generate.py +++ b/sphinx/ext/autosummary/generate.py @@ -27,6 +27,7 @@ import optparse from jinja2 import FileSystemLoader, TemplateNotFound from jinja2.sandbox import SandboxedEnvironment +from sphinx import package_dir from sphinx.ext.autosummary import import_by_name, get_documenter from sphinx.jinja2glue import BuiltinTemplateLoader from sphinx.util.osutil import ensuredir @@ -78,7 +79,7 @@ def generate_autosummary_docs(sources, output_dir=None, suffix='.rst', sources = [os.path.join(base_path, filename) for filename in sources] # create our own templating environment - template_dirs = [os.path.join(os.path.dirname(__file__), 'templates')] + template_dirs = [os.path.join(package_dir, 'ext', 'autosummary', 'templates')] if builder is not None: # allow the user to override the templates template_loader = BuiltinTemplateLoader() diff --git a/sphinx/pycode/__init__.py b/sphinx/pycode/__init__.py index 09f7e2208..ef626f6d1 100644 --- a/sphinx/pycode/__init__.py +++ b/sphinx/pycode/__init__.py @@ -11,6 +11,7 @@ from os import path +from sphinx import package_dir from sphinx.errors import PycodeError from sphinx.pycode import nodes from sphinx.pycode.pgen2 import driver, token, tokenize, parse, literals @@ -20,7 +21,7 @@ from sphinx.util.docstrings import prepare_docstring, prepare_commentdoc # load the Python grammar -_grammarfile = path.join(path.dirname(__file__), 'Grammar.txt') +_grammarfile = path.join(package_dir, 'pycode', 'Grammar.txt') pygrammar = driver.load_grammar(_grammarfile) pydriver = driver.Driver(pygrammar, convert=nodes.convert) diff --git a/sphinx/websupport/__init__.py b/sphinx/websupport/__init__.py index e054812e3..61b63cab2 100644 --- a/sphinx/websupport/__init__.py +++ b/sphinx/websupport/__init__.py @@ -87,7 +87,7 @@ class WebSupport(object): def _init_templating(self): import sphinx - template_path = path.join(path.dirname(sphinx.__file__), + template_path = path.join(sphinx.package_dir, 'themes', 'basic') loader = FileSystemLoader(template_path) self.template_env = Environment(loader=loader) From fd56b7c44a65379f776c0d33621e3590d808611f Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Tue, 1 Nov 2011 09:14:23 +0100 Subject: [PATCH 05/12] Closes #792: Include "sphinx-apidoc" in the source distribution. --- CHANGES | 2 ++ MANIFEST.in | 1 + 2 files changed, 3 insertions(+) diff --git a/CHANGES b/CHANGES index fe7f6f46e..3995bbe45 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,8 @@ Release 1.1.1 (in development) ============================== +* #792: Include "sphinx-apidoc" in the source distribution. + * #797: Don't crash on a misformatted glossary. * #801: Make intersphinx work properly without SSL support. diff --git a/MANIFEST.in b/MANIFEST.in index cfc44c17e..214b81608 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -11,6 +11,7 @@ include distribute_setup.py include sphinx-autogen.py include sphinx-build.py include sphinx-quickstart.py +include sphinx-apidoc.py recursive-include sphinx/texinputs * recursive-include sphinx/themes * From 53d06fda7b44c6966d74da50d151a5a469b240e1 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Tue, 1 Nov 2011 09:16:37 +0100 Subject: [PATCH 06/12] Closes #793: Fix docutils version references. --- doc/ext/appapi.rst | 7 ++----- doc/intro.rst | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/doc/ext/appapi.rst b/doc/ext/appapi.rst index 643de9950..1f5c063c7 100644 --- a/doc/ext/appapi.rst +++ b/doc/ext/appapi.rst @@ -115,11 +115,8 @@ the following public API: `_ for details. - The directive class normally must inherit from the class - ``docutils.parsers.rst.Directive``. When writing a directive for usage in - a Sphinx extension, you inherit from ``sphinx.util.compat.Directive`` - instead which does the right thing even on docutils 0.4 (which doesn't - support directive classes otherwise). + The directive class must inherit from the class + ``docutils.parsers.rst.Directive``. For example, the (already existing) :rst:dir:`literalinclude` directive would be added like this: diff --git a/doc/intro.rst b/doc/intro.rst index 46e4436bb..5d76dd29c 100644 --- a/doc/intro.rst +++ b/doc/intro.rst @@ -51,7 +51,7 @@ Prerequisites ------------- Sphinx needs at least **Python 2.4** or **Python 3.1** to run, as well as the -docutils_ and Jinja2_ libraries. Sphinx should work with docutils version 0.5 +docutils_ and Jinja2_ libraries. Sphinx should work with docutils version 0.7 or some (not broken) SVN trunk snapshot. If you like to have source code highlighting support, you must also install the Pygments_ library. From 8fdeaec0184e8ded18c09c12d0ed695d532843e5 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Tue, 1 Nov 2011 09:24:34 +0100 Subject: [PATCH 07/12] Closes #791: Fix QtHelp and HtmlHelp index entry links. --- CHANGES | 2 ++ sphinx/builders/htmlhelp.py | 3 ++- sphinx/builders/qthelp.py | 6 +++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index 3995bbe45..545ad5608 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,8 @@ Release 1.1.1 (in development) ============================== +* #791: Fix QtHelp and HtmlHelp index entry links. + * #792: Include "sphinx-apidoc" in the source distribution. * #797: Don't crash on a misformatted glossary. diff --git a/sphinx/builders/htmlhelp.py b/sphinx/builders/htmlhelp.py index 143f6df9e..f09f42e9a 100644 --- a/sphinx/builders/htmlhelp.py +++ b/sphinx/builders/htmlhelp.py @@ -258,7 +258,8 @@ class HTMLHelpBuilder(StandaloneHTMLBuilder): f.write('
    \n') def write_index(title, refs, subitems): def write_param(name, value): - item = ' \n' % (name, value) + item = ' \n' % \ + (name, value[1]) f.write(item) title = cgi.escape(title) f.write('
  • \n') diff --git a/sphinx/builders/qthelp.py b/sphinx/builders/qthelp.py index 5598aad2c..b2ff26f4d 100644 --- a/sphinx/builders/qthelp.py +++ b/sphinx/builders/qthelp.py @@ -256,7 +256,7 @@ class QtHelpBuilder(StandaloneHTMLBuilder): groupdict = matchobj.groupdict() shortname = groupdict['title'] id = groupdict.get('id') -# descr = groupdict.get('descr') + #descr = groupdict.get('descr') if shortname.endswith('()'): shortname = shortname[:-2] id = '%s.%s' % (id, shortname) @@ -265,9 +265,9 @@ class QtHelpBuilder(StandaloneHTMLBuilder): if id: item = ' '*12 + '' % ( - name, id, ref) + name, id, ref[1]) else: - item = ' '*12 + '' % (name, ref) + item = ' '*12 + '' % (name, ref[1]) item.encode('ascii', 'xmlcharrefreplace') return item From 21cfc46dc30d10d952b00fc237a518fff675a2d9 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Tue, 1 Nov 2011 09:26:05 +0100 Subject: [PATCH 08/12] Fix DevHelp index entries too. --- CHANGES | 2 +- sphinx/builders/devhelp.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index 545ad5608..c4157c340 100644 --- a/CHANGES +++ b/CHANGES @@ -1,7 +1,7 @@ Release 1.1.1 (in development) ============================== -* #791: Fix QtHelp and HtmlHelp index entry links. +* #791: Fix QtHelp, DevHelp and HtmlHelp index entry links. * #792: Include "sphinx-apidoc" in the source distribution. diff --git a/sphinx/builders/devhelp.py b/sphinx/builders/devhelp.py index a1b419453..62bd22377 100644 --- a/sphinx/builders/devhelp.py +++ b/sphinx/builders/devhelp.py @@ -107,12 +107,12 @@ class DevhelpBuilder(StandaloneHTMLBuilder): pass elif len(refs) == 1: etree.SubElement(functions, 'function', - name=title, link=refs[0]) + name=title, link=refs[0][1]) else: for i, ref in enumerate(refs): etree.SubElement(functions, 'function', name="[%d] %s" % (i, title), - link=ref) + link=ref[1]) if subitems: parent_title = re.sub(r'\s*\(.*\)\s*$', '', title) From c6833609c07523605731a5c95860d0199c5a7620 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Tue, 1 Nov 2011 15:21:46 +0100 Subject: [PATCH 09/12] Fix relative_path() argument order. --- sphinx/environment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sphinx/environment.py b/sphinx/environment.py index 54d9ee15e..9fd9ff89a 100644 --- a/sphinx/environment.py +++ b/sphinx/environment.py @@ -198,7 +198,7 @@ class Locale(Transform): settings, source = self.document.settings, self.document['source'] # XXX check if this is reliable assert source.startswith(env.srcdir) - docname = path.splitext(relative_path(source, env.srcdir))[0] + docname = path.splitext(relative_path(env.srcdir, source))[0] textdomain = find_catalog(docname, self.document.settings.gettext_compact) From a88eb5f0ef3559039ac7ca13c87debb2200673bd Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Tue, 1 Nov 2011 15:23:16 +0100 Subject: [PATCH 10/12] Fix overlong lines. --- sphinx/apidoc.py | 3 ++- sphinx/ext/autosummary/generate.py | 3 ++- sphinx/quickstart.py | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/sphinx/apidoc.py b/sphinx/apidoc.py index 7e7f341fc..16566761b 100644 --- a/sphinx/apidoc.py +++ b/sphinx/apidoc.py @@ -8,7 +8,8 @@ creates a modules index (named modules.). This is derived from the "sphinx-autopackage" script, which is: - Copyright 2008 Société des arts technologiques (SAT), http://www.sat.qc.ca/ + Copyright 2008 Société des arts technologiques (SAT), + http://www.sat.qc.ca/ :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. diff --git a/sphinx/ext/autosummary/generate.py b/sphinx/ext/autosummary/generate.py index de1578a26..faba11605 100644 --- a/sphinx/ext/autosummary/generate.py +++ b/sphinx/ext/autosummary/generate.py @@ -79,7 +79,8 @@ def generate_autosummary_docs(sources, output_dir=None, suffix='.rst', sources = [os.path.join(base_path, filename) for filename in sources] # create our own templating environment - template_dirs = [os.path.join(package_dir, 'ext', 'autosummary', 'templates')] + template_dirs = [os.path.join(package_dir, 'ext', + 'autosummary', 'templates')] if builder is not None: # allow the user to override the templates template_loader = BuiltinTemplateLoader() diff --git a/sphinx/quickstart.py b/sphinx/quickstart.py index 88be5ceee..86dc04762 100644 --- a/sphinx/quickstart.py +++ b/sphinx/quickstart.py @@ -267,8 +267,9 @@ man_pages = [ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - ('%(master_str)s', '%(project_fn)s', u'%(project_doc_str)s', u'%(author_str)s', - '%(project_fn)s', 'One line description of project.', 'Miscellaneous'), + ('%(master_str)s', '%(project_fn)s', u'%(project_doc_str)s', + u'%(author_str)s', '%(project_fn)s', 'One line description of project.', + 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. From 313a428fa870d04529d77e0d470cb9a66662dd53 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Tue, 1 Nov 2011 15:24:26 +0100 Subject: [PATCH 11/12] Prepare for release 1.1.1. --- CHANGES | 4 ++-- sphinx/__init__.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index c4157c340..2c10a97a5 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,5 @@ -Release 1.1.1 (in development) -============================== +Release 1.1.1 (Nov 1, 2011) +=========================== * #791: Fix QtHelp, DevHelp and HtmlHelp index entry links. diff --git a/sphinx/__init__.py b/sphinx/__init__.py index f1ddb7535..8a492228b 100644 --- a/sphinx/__init__.py +++ b/sphinx/__init__.py @@ -15,8 +15,8 @@ import sys from os import path -__version__ = '1.1' -__released__ = '1.1' # used when Sphinx builds its own docs +__version__ = '1.1.1' +__released__ = '1.1.1' # used when Sphinx builds its own docs package_dir = path.abspath(path.dirname(__file__))