Merge lp:~andrewsomething/ubuntu/precise/sphinx/1.1.3+dfsg-2ubuntu1 into lp:ubuntu/precise/sphinx

Proposed by Andrew Starr-Bochicchio
Status: Merged
Merged at revision: 31
Proposed branch: lp:~andrewsomething/ubuntu/precise/sphinx/1.1.3+dfsg-2ubuntu1
Merge into: lp:ubuntu/precise/sphinx
Diff against target: 2803 lines (+512/-1186)
59 files modified
.pc/applied-patches (+0/-5)
.pc/disable_distribute_setup.diff/setup.py (+0/-208)
.pc/initialize_autodoc.diff/sphinx/ext/autosummary/generate.py (+0/-319)
.pc/show_more_stack_frames.diff/sphinx/cmdline.py (+0/-228)
.pc/sphinxcontrib_namespace.diff/sphinx/__init__.py (+0/-76)
.pc/unversioned_grammar_pickle.diff/sphinx/pycode/pgen2/driver.py (+0/-145)
CHANGES (+58/-0)
PKG-INFO (+2/-2)
Sphinx.egg-info/PKG-INFO (+2/-2)
debian/changelog (+53/-1)
debian/control (+11/-9)
debian/jstest/run-tests (+4/-4)
debian/patches/python3_test_build_dir.diff (+23/-0)
debian/patches/series (+2/-0)
debian/patches/skiptest_latex.diff (+42/-0)
debian/rules (+5/-4)
doc/ext/math.rst (+4/-0)
doc/markup/misc.rst (+7/-0)
setup.cfg (+13/-13)
setup.py (+0/-1)
sphinx/__init__.py (+2/-15)
sphinx/apidoc.py (+9/-6)
sphinx/builders/changes.py (+7/-4)
sphinx/builders/html.py (+5/-2)
sphinx/builders/htmlhelp.py (+29/-18)
sphinx/builders/qthelp.py (+25/-24)
sphinx/cmdline.py (+4/-4)
sphinx/config.py (+3/-2)
sphinx/domains/cpp.py (+2/-2)
sphinx/domains/python.py (+19/-17)
sphinx/domains/std.py (+6/-1)
sphinx/environment.py (+33/-12)
sphinx/ext/autodoc.py (+7/-3)
sphinx/ext/autosummary/generate.py (+0/-10)
sphinx/ext/doctest.py (+12/-2)
sphinx/ext/inheritance_diagram.py (+2/-1)
sphinx/ext/intersphinx.py (+7/-1)
sphinx/highlighting.py (+6/-4)
sphinx/locale/fr/LC_MESSAGES/sphinx.po (+4/-10)
sphinx/pycode/pgen2/driver.py (+1/-1)
sphinx/setup_command.py (+3/-0)
sphinx/texinputs/sphinx.sty (+6/-9)
sphinx/texinputs/sphinxhowto.cls (+11/-0)
sphinx/texinputs/sphinxmanual.cls (+11/-0)
sphinx/themes/basic/static/basic.css_t (+2/-2)
sphinx/util/__init__.py (+2/-1)
sphinx/util/inspect.py (+5/-0)
sphinx/util/nodes.py (+4/-0)
sphinx/util/osutil.py (+6/-1)
sphinx/util/pycompat.py (+5/-0)
sphinx/websupport/__init__.py (+2/-2)
sphinx/websupport/storage/differ.py (+3/-2)
sphinx/websupport/storage/sqlalchemy_db.py (+18/-4)
sphinx/writers/html.py (+7/-1)
sphinx/writers/latex.py (+2/-1)
tests/run.py (+5/-3)
tests/test_build_html.py (+6/-2)
tests/test_intersphinx.py (+3/-0)
tests/test_quickstart.py (+2/-2)
To merge this branch: bzr merge lp:~andrewsomething/ubuntu/precise/sphinx/1.1.3+dfsg-2ubuntu1
Reviewer Review Type Date Requested Status
Didier Roche-Tolomelli Approve
Ubuntu branches Pending
Review via email: mp+99622@code.launchpad.net

Description of the change

Merge new upstream bugfix release from Debian Testing.

Please wait to upload until after Beta Freeze is lifted, sphinx is seeded.

To post a comment you must log in.
Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

Hey Andrew!
After a discussion with Martin:

didrocks | pitti: do you think: should I sponsor in -proposed, don't do anything for packages in main until beta freeze is lifted? (or just upload in main and the release team won't approve it until
         | the freeze is lifted)
   pitti | didrocks: the latter usually
   pitti | didrocks: there's plenty of stuff in unapproved which is for after beta-2
didrocks | ok, wasn't sure for main components though ;)

The changes looks good, let's stage it in the UNAPPROVED queue until we unfreeze. Thanks again Andrew :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed file '.pc/applied-patches'
2--- .pc/applied-patches 2012-02-05 19:33:59 +0000
3+++ .pc/applied-patches 1970-01-01 00:00:00 +0000
4@@ -1,5 +0,0 @@
5-disable_distribute_setup.diff
6-unversioned_grammar_pickle.diff
7-show_more_stack_frames.diff
8-initialize_autodoc.diff
9-sphinxcontrib_namespace.diff
10
11=== removed directory '.pc/disable_distribute_setup.diff'
12=== removed file '.pc/disable_distribute_setup.diff/setup.py'
13--- .pc/disable_distribute_setup.diff/setup.py 2011-11-20 15:56:50 +0000
14+++ .pc/disable_distribute_setup.diff/setup.py 1970-01-01 00:00:00 +0000
15@@ -1,208 +0,0 @@
16-# -*- coding: utf-8 -*-
17-try:
18- from setuptools import setup, find_packages
19-except ImportError:
20- import distribute_setup
21- distribute_setup.use_setuptools()
22- from setuptools import setup, find_packages
23-
24-import os
25-import sys
26-from distutils import log
27-
28-import sphinx
29-
30-long_desc = '''
31-Sphinx is a tool that makes it easy to create intelligent and beautiful
32-documentation for Python projects (or other documents consisting of multiple
33-reStructuredText sources), written by Georg Brandl. It was originally created
34-for the new Python documentation, and has excellent facilities for Python
35-project documentation, but C/C++ is supported as well, and more languages are
36-planned.
37-
38-Sphinx uses reStructuredText as its markup language, and many of its strengths
39-come from the power and straightforwardness of reStructuredText and its parsing
40-and translating suite, the Docutils.
41-
42-Among its features are the following:
43-
44-* Output formats: HTML (including derivative formats such as HTML Help, Epub
45- and Qt Help), plain text, manual pages and LaTeX or direct PDF output
46- using rst2pdf
47-* Extensive cross-references: semantic markup and automatic links
48- for functions, classes, glossary terms and similar pieces of information
49-* Hierarchical structure: easy definition of a document tree, with automatic
50- links to siblings, parents and children
51-* Automatic indices: general index as well as a module index
52-* Code handling: automatic highlighting using the Pygments highlighter
53-* Flexible HTML output using the Jinja 2 templating engine
54-* Various extensions are available, e.g. for automatic testing of snippets
55- and inclusion of appropriately formatted docstrings
56-* Setuptools integration
57-
58-A development egg can be found `here
59-<http://bitbucket.org/birkenfeld/sphinx/get/tip.gz#egg=Sphinx-dev>`_.
60-'''
61-
62-requires = ['Pygments>=1.2', 'Jinja2>=2.3', 'docutils>=0.7']
63-
64-if sys.version_info < (2, 4):
65- print('ERROR: Sphinx requires at least Python 2.4 to run.')
66- sys.exit(1)
67-
68-if sys.version_info < (2, 5):
69- # Python 2.4's distutils doesn't automatically install an egg-info,
70- # so an existing docutils install won't be detected -- in that case,
71- # remove the dependency from setup.py
72- try:
73- import docutils
74- if int(docutils.__version__[2]) < 4:
75- raise ValueError('docutils not recent enough')
76- except:
77- pass
78- else:
79- del requires[-1]
80-
81- # The uuid module is new in the stdlib in 2.5
82- requires.append('uuid>=1.30')
83-
84-
85-# Provide a "compile_catalog" command that also creates the translated
86-# JavaScript files if Babel is available.
87-
88-cmdclass = {}
89-
90-try:
91- from babel.messages.pofile import read_po
92- from babel.messages.frontend import compile_catalog
93- try:
94- from simplejson import dump
95- except ImportError:
96- from json import dump
97-except ImportError:
98- pass
99-else:
100- class compile_catalog_plusjs(compile_catalog):
101- """
102- An extended command that writes all message strings that occur in
103- JavaScript files to a JavaScript file along with the .mo file.
104-
105- Unfortunately, babel's setup command isn't built very extensible, so
106- most of the run() code is duplicated here.
107- """
108-
109- def run(self):
110- compile_catalog.run(self)
111-
112- po_files = []
113- js_files = []
114-
115- if not self.input_file:
116- if self.locale:
117- po_files.append((self.locale,
118- os.path.join(self.directory, self.locale,
119- 'LC_MESSAGES',
120- self.domain + '.po')))
121- js_files.append(os.path.join(self.directory, self.locale,
122- 'LC_MESSAGES',
123- self.domain + '.js'))
124- else:
125- for locale in os.listdir(self.directory):
126- po_file = os.path.join(self.directory, locale,
127- 'LC_MESSAGES',
128- self.domain + '.po')
129- if os.path.exists(po_file):
130- po_files.append((locale, po_file))
131- js_files.append(os.path.join(self.directory, locale,
132- 'LC_MESSAGES',
133- self.domain + '.js'))
134- else:
135- po_files.append((self.locale, self.input_file))
136- if self.output_file:
137- js_files.append(self.output_file)
138- else:
139- js_files.append(os.path.join(self.directory, self.locale,
140- 'LC_MESSAGES',
141- self.domain + '.js'))
142-
143- for js_file, (locale, po_file) in zip(js_files, po_files):
144- infile = open(po_file, 'r')
145- try:
146- catalog = read_po(infile, locale)
147- finally:
148- infile.close()
149-
150- if catalog.fuzzy and not self.use_fuzzy:
151- continue
152-
153- log.info('writing JavaScript strings in catalog %r to %r',
154- po_file, js_file)
155-
156- jscatalog = {}
157- for message in catalog:
158- if any(x[0].endswith('.js') for x in message.locations):
159- msgid = message.id
160- if isinstance(msgid, (list, tuple)):
161- msgid = msgid[0]
162- jscatalog[msgid] = message.string
163-
164- outfile = open(js_file, 'wb')
165- try:
166- outfile.write('Documentation.addTranslations(');
167- dump(dict(
168- messages=jscatalog,
169- plural_expr=catalog.plural_expr,
170- locale=str(catalog.locale)
171- ), outfile)
172- outfile.write(');')
173- finally:
174- outfile.close()
175-
176- cmdclass['compile_catalog'] = compile_catalog_plusjs
177-
178-
179-setup(
180- name='Sphinx',
181- version=sphinx.__version__,
182- url='http://sphinx.pocoo.org/',
183- download_url='http://pypi.python.org/pypi/Sphinx',
184- license='BSD',
185- author='Georg Brandl',
186- author_email='georg@python.org',
187- description='Python documentation generator',
188- long_description=long_desc,
189- zip_safe=False,
190- classifiers=[
191- 'Development Status :: 5 - Production/Stable',
192- 'Environment :: Console',
193- 'Environment :: Web Environment',
194- 'Intended Audience :: Developers',
195- 'Intended Audience :: Education',
196- 'License :: OSI Approved :: BSD License',
197- 'Operating System :: OS Independent',
198- 'Programming Language :: Python',
199- 'Programming Language :: Python :: 2',
200- 'Programming Language :: Python :: 3',
201- 'Topic :: Documentation',
202- 'Topic :: Text Processing',
203- 'Topic :: Utilities',
204- ],
205- platforms='any',
206- packages=find_packages(exclude=['custom_fixers', 'test']),
207- include_package_data=True,
208- entry_points={
209- 'console_scripts': [
210- 'sphinx-build = sphinx:main',
211- 'sphinx-quickstart = sphinx.quickstart:main',
212- 'sphinx-apidoc = sphinx.apidoc:main',
213- 'sphinx-autogen = sphinx.ext.autosummary.generate:main',
214- ],
215- 'distutils.commands': [
216- 'build_sphinx = sphinx.setup_command:BuildDoc',
217- ],
218- },
219- install_requires=requires,
220- cmdclass=cmdclass,
221- use_2to3=True,
222- use_2to3_fixers=['custom_fixers'],
223-)
224
225=== removed directory '.pc/initialize_autodoc.diff'
226=== removed directory '.pc/initialize_autodoc.diff/sphinx'
227=== removed directory '.pc/initialize_autodoc.diff/sphinx/ext'
228=== removed directory '.pc/initialize_autodoc.diff/sphinx/ext/autosummary'
229=== removed file '.pc/initialize_autodoc.diff/sphinx/ext/autosummary/generate.py'
230--- .pc/initialize_autodoc.diff/sphinx/ext/autosummary/generate.py 2012-02-05 19:33:59 +0000
231+++ .pc/initialize_autodoc.diff/sphinx/ext/autosummary/generate.py 1970-01-01 00:00:00 +0000
232@@ -1,319 +0,0 @@
233-# -*- coding: utf-8 -*-
234-"""
235- sphinx.ext.autosummary.generate
236- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
237-
238- Usable as a library or script to generate automatic RST source files for
239- items referred to in autosummary:: directives.
240-
241- Each generated RST file contains a single auto*:: directive which
242- extracts the docstring of the referred item.
243-
244- Example Makefile rule::
245-
246- generate:
247- sphinx-autogen -o source/generated source/*.rst
248-
249- :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
250- :license: BSD, see LICENSE for details.
251-"""
252-
253-import os
254-import re
255-import sys
256-import pydoc
257-import optparse
258-
259-from jinja2 import FileSystemLoader, TemplateNotFound
260-from jinja2.sandbox import SandboxedEnvironment
261-
262-from sphinx import package_dir
263-from sphinx.ext.autosummary import import_by_name, get_documenter
264-from sphinx.jinja2glue import BuiltinTemplateLoader
265-from sphinx.util.osutil import ensuredir
266-from sphinx.util.inspect import safe_getattr
267-
268-def main(argv=sys.argv):
269- usage = """%prog [OPTIONS] SOURCEFILE ..."""
270- p = optparse.OptionParser(usage.strip())
271- p.add_option("-o", "--output-dir", action="store", type="string",
272- dest="output_dir", default=None,
273- help="Directory to place all output in")
274- p.add_option("-s", "--suffix", action="store", type="string",
275- dest="suffix", default="rst",
276- help="Default suffix for files (default: %default)")
277- p.add_option("-t", "--templates", action="store", type="string",
278- dest="templates", default=None,
279- help="Custom template directory (default: %default)")
280- options, args = p.parse_args(argv[1:])
281-
282- if len(args) < 1:
283- p.error('no input files given')
284-
285- generate_autosummary_docs(args, options.output_dir,
286- "." + options.suffix,
287- template_dir=options.templates)
288-
289-def _simple_info(msg):
290- print msg
291-
292-def _simple_warn(msg):
293- print >> sys.stderr, 'WARNING: ' + msg
294-
295-# -- Generating output ---------------------------------------------------------
296-
297-def generate_autosummary_docs(sources, output_dir=None, suffix='.rst',
298- warn=_simple_warn, info=_simple_info,
299- base_path=None, builder=None, template_dir=None):
300-
301- showed_sources = list(sorted(sources))
302- if len(showed_sources) > 20:
303- showed_sources = showed_sources[:10] + ['...'] + showed_sources[-10:]
304- info('[autosummary] generating autosummary for: %s' %
305- ', '.join(showed_sources))
306-
307- if output_dir:
308- info('[autosummary] writing to %s' % output_dir)
309-
310- if base_path is not None:
311- sources = [os.path.join(base_path, filename) for filename in sources]
312-
313- # create our own templating environment
314- template_dirs = [os.path.join(package_dir, 'ext',
315- 'autosummary', 'templates')]
316- if builder is not None:
317- # allow the user to override the templates
318- template_loader = BuiltinTemplateLoader()
319- template_loader.init(builder, dirs=template_dirs)
320- else:
321- if template_dir:
322- template_dirs.insert(0, template_dir)
323- template_loader = FileSystemLoader(template_dirs)
324- template_env = SandboxedEnvironment(loader=template_loader)
325-
326- # read
327- items = find_autosummary_in_files(sources)
328-
329- # remove possible duplicates
330- items = dict([(item, True) for item in items]).keys()
331-
332- # keep track of new files
333- new_files = []
334-
335- # write
336- for name, path, template_name in sorted(items):
337- if path is None:
338- # The corresponding autosummary:: directive did not have
339- # a :toctree: option
340- continue
341-
342- path = output_dir or os.path.abspath(path)
343- ensuredir(path)
344-
345- try:
346- name, obj, parent = import_by_name(name)
347- except ImportError, e:
348- warn('[autosummary] failed to import %r: %s' % (name, e))
349- continue
350-
351- fn = os.path.join(path, name + suffix)
352-
353- # skip it if it exists
354- if os.path.isfile(fn):
355- continue
356-
357- new_files.append(fn)
358-
359- f = open(fn, 'w')
360-
361- try:
362- doc = get_documenter(obj, parent)
363-
364- if template_name is not None:
365- template = template_env.get_template(template_name)
366- else:
367- try:
368- template = template_env.get_template('autosummary/%s.rst'
369- % doc.objtype)
370- except TemplateNotFound:
371- template = template_env.get_template('autosummary/base.rst')
372-
373- def get_members(obj, typ, include_public=[]):
374- items = []
375- for name in dir(obj):
376- try:
377- documenter = get_documenter(safe_getattr(obj, name),
378- obj)
379- except AttributeError:
380- continue
381- if documenter.objtype == typ:
382- items.append(name)
383- public = [x for x in items
384- if x in include_public or not x.startswith('_')]
385- return public, items
386-
387- ns = {}
388-
389- if doc.objtype == 'module':
390- ns['members'] = dir(obj)
391- ns['functions'], ns['all_functions'] = \
392- get_members(obj, 'function')
393- ns['classes'], ns['all_classes'] = \
394- get_members(obj, 'class')
395- ns['exceptions'], ns['all_exceptions'] = \
396- get_members(obj, 'exception')
397- elif doc.objtype == 'class':
398- ns['members'] = dir(obj)
399- ns['methods'], ns['all_methods'] = \
400- get_members(obj, 'method', ['__init__'])
401- ns['attributes'], ns['all_attributes'] = \
402- get_members(obj, 'attribute')
403-
404- parts = name.split('.')
405- if doc.objtype in ('method', 'attribute'):
406- mod_name = '.'.join(parts[:-2])
407- cls_name = parts[-2]
408- obj_name = '.'.join(parts[-2:])
409- ns['class'] = cls_name
410- else:
411- mod_name, obj_name = '.'.join(parts[:-1]), parts[-1]
412-
413- ns['fullname'] = name
414- ns['module'] = mod_name
415- ns['objname'] = obj_name
416- ns['name'] = parts[-1]
417-
418- ns['objtype'] = doc.objtype
419- ns['underline'] = len(name) * '='
420-
421- rendered = template.render(**ns)
422- f.write(rendered)
423- finally:
424- f.close()
425-
426- # descend recursively to new files
427- if new_files:
428- generate_autosummary_docs(new_files, output_dir=output_dir,
429- suffix=suffix, warn=warn, info=info,
430- base_path=base_path, builder=builder,
431- template_dir=template_dir)
432-
433-
434-# -- Finding documented entries in files ---------------------------------------
435-
436-def find_autosummary_in_files(filenames):
437- """Find out what items are documented in source/*.rst.
438-
439- See `find_autosummary_in_lines`.
440- """
441- documented = []
442- for filename in filenames:
443- f = open(filename, 'r')
444- lines = f.read().splitlines()
445- documented.extend(find_autosummary_in_lines(lines, filename=filename))
446- f.close()
447- return documented
448-
449-def find_autosummary_in_docstring(name, module=None, filename=None):
450- """Find out what items are documented in the given object's docstring.
451-
452- See `find_autosummary_in_lines`.
453- """
454- try:
455- real_name, obj, parent = import_by_name(name)
456- lines = pydoc.getdoc(obj).splitlines()
457- return find_autosummary_in_lines(lines, module=name, filename=filename)
458- except AttributeError:
459- pass
460- except ImportError, e:
461- print "Failed to import '%s': %s" % (name, e)
462- return []
463-
464-def find_autosummary_in_lines(lines, module=None, filename=None):
465- """Find out what items appear in autosummary:: directives in the
466- given lines.
467-
468- Returns a list of (name, toctree, template) where *name* is a name
469- of an object and *toctree* the :toctree: path of the corresponding
470- autosummary directive (relative to the root of the file name), and
471- *template* the value of the :template: option. *toctree* and
472- *template* ``None`` if the directive does not have the
473- corresponding options set.
474- """
475- autosummary_re = re.compile(r'^(\s*)\.\.\s+autosummary::\s*')
476- automodule_re = re.compile(
477- r'^\s*\.\.\s+automodule::\s*([A-Za-z0-9_.]+)\s*$')
478- module_re = re.compile(
479- r'^\s*\.\.\s+(current)?module::\s*([a-zA-Z0-9_.]+)\s*$')
480- autosummary_item_re = re.compile(r'^\s+(~?[_a-zA-Z][a-zA-Z0-9_.]*)\s*.*?')
481- toctree_arg_re = re.compile(r'^\s+:toctree:\s*(.*?)\s*$')
482- template_arg_re = re.compile(r'^\s+:template:\s*(.*?)\s*$')
483-
484- documented = []
485-
486- toctree = None
487- template = None
488- current_module = module
489- in_autosummary = False
490- base_indent = ""
491-
492- for line in lines:
493- if in_autosummary:
494- m = toctree_arg_re.match(line)
495- if m:
496- toctree = m.group(1)
497- if filename:
498- toctree = os.path.join(os.path.dirname(filename),
499- toctree)
500- continue
501-
502- m = template_arg_re.match(line)
503- if m:
504- template = m.group(1).strip()
505- continue
506-
507- if line.strip().startswith(':'):
508- continue # skip options
509-
510- m = autosummary_item_re.match(line)
511- if m:
512- name = m.group(1).strip()
513- if name.startswith('~'):
514- name = name[1:]
515- if current_module and \
516- not name.startswith(current_module + '.'):
517- name = "%s.%s" % (current_module, name)
518- documented.append((name, toctree, template))
519- continue
520-
521- if not line.strip() or line.startswith(base_indent + " "):
522- continue
523-
524- in_autosummary = False
525-
526- m = autosummary_re.match(line)
527- if m:
528- in_autosummary = True
529- base_indent = m.group(1)
530- toctree = None
531- template = None
532- continue
533-
534- m = automodule_re.search(line)
535- if m:
536- current_module = m.group(1).strip()
537- # recurse into the automodule docstring
538- documented.extend(find_autosummary_in_docstring(
539- current_module, filename=filename))
540- continue
541-
542- m = module_re.match(line)
543- if m:
544- current_module = m.group(2)
545- continue
546-
547- return documented
548-
549-
550-if __name__ == '__main__':
551- main()
552
553=== removed directory '.pc/show_more_stack_frames.diff'
554=== removed directory '.pc/show_more_stack_frames.diff/sphinx'
555=== removed file '.pc/show_more_stack_frames.diff/sphinx/cmdline.py'
556--- .pc/show_more_stack_frames.diff/sphinx/cmdline.py 2011-11-20 15:56:50 +0000
557+++ .pc/show_more_stack_frames.diff/sphinx/cmdline.py 1970-01-01 00:00:00 +0000
558@@ -1,228 +0,0 @@
559-# -*- coding: utf-8 -*-
560-"""
561- sphinx.cmdline
562- ~~~~~~~~~~~~~~
563-
564- sphinx-build command-line handling.
565-
566- :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
567- :license: BSD, see LICENSE for details.
568-"""
569-
570-import os
571-import sys
572-import getopt
573-import traceback
574-from os import path
575-
576-from docutils.utils import SystemMessage
577-
578-from sphinx import __version__
579-from sphinx.errors import SphinxError
580-from sphinx.application import Sphinx
581-from sphinx.util import Tee, format_exception_cut_frames, save_traceback
582-from sphinx.util.console import red, nocolor, color_terminal
583-from sphinx.util.pycompat import terminal_safe
584-
585-
586-def usage(argv, msg=None):
587- if msg:
588- print >>sys.stderr, msg
589- print >>sys.stderr
590- print >>sys.stderr, """\
591-Sphinx v%s
592-Usage: %s [options] sourcedir outdir [filenames...]
593-Options: -b <builder> -- builder to use; default is html
594- -a -- write all files; default is to only write \
595-new and changed files
596- -E -- don't use a saved environment, always read all files
597- -t <tag> -- include "only" blocks with <tag>
598- -d <path> -- path for the cached environment and doctree files
599- (default: outdir/.doctrees)
600- -c <path> -- path where configuration file (conf.py) is located
601- (default: same as sourcedir)
602- -C -- use no config file at all, only -D options
603- -D <setting=value> -- override a setting in configuration
604- -A <name=value> -- pass a value into the templates, for HTML builder
605- -n -- nit-picky mode, warn about all missing references
606- -N -- do not do colored output
607- -q -- no output on stdout, just warnings on stderr
608- -Q -- no output at all, not even warnings
609- -w <file> -- write warnings (and errors) to given file
610- -W -- turn warnings into errors
611- -P -- run Pdb on exception
612-Modi:
613-* without -a and without filenames, write new and changed files.
614-* with -a, write all files.
615-* with filenames, write these.""" % (__version__, argv[0])
616-
617-
618-def main(argv):
619- if not color_terminal():
620- # Windows' poor cmd box doesn't understand ANSI sequences
621- nocolor()
622-
623- try:
624- opts, args = getopt.getopt(argv[1:], 'ab:t:d:c:CD:A:ng:NEqQWw:P')
625- allopts = set(opt[0] for opt in opts)
626- srcdir = confdir = path.abspath(args[0])
627- if not path.isdir(srcdir):
628- print >>sys.stderr, 'Error: Cannot find source directory.'
629- return 1
630- if not path.isfile(path.join(srcdir, 'conf.py')) and \
631- '-c' not in allopts and '-C' not in allopts:
632- print >>sys.stderr, ('Error: Source directory doesn\'t '
633- 'contain conf.py file.')
634- return 1
635- outdir = path.abspath(args[1])
636- if not path.isdir(outdir):
637- print >>sys.stderr, 'Making output directory...'
638- os.makedirs(outdir)
639- except (IndexError, getopt.error):
640- usage(argv)
641- return 1
642-
643- filenames = args[2:]
644- err = 0
645- for filename in filenames:
646- if not path.isfile(filename):
647- print >>sys.stderr, 'Cannot find file %r.' % filename
648- err = 1
649- if err:
650- return 1
651-
652- # likely encoding used for command-line arguments
653- try:
654- locale = __import__('locale') # due to submodule of the same name
655- likely_encoding = locale.getpreferredencoding()
656- except Exception:
657- likely_encoding = None
658-
659- buildername = None
660- force_all = freshenv = warningiserror = use_pdb = False
661- status = sys.stdout
662- warning = sys.stderr
663- error = sys.stderr
664- warnfile = None
665- confoverrides = {}
666- tags = []
667- doctreedir = path.join(outdir, '.doctrees')
668- for opt, val in opts:
669- if opt == '-b':
670- buildername = val
671- elif opt == '-a':
672- if filenames:
673- usage(argv, 'Cannot combine -a option and filenames.')
674- return 1
675- force_all = True
676- elif opt == '-t':
677- tags.append(val)
678- elif opt == '-d':
679- doctreedir = path.abspath(val)
680- elif opt == '-c':
681- confdir = path.abspath(val)
682- if not path.isfile(path.join(confdir, 'conf.py')):
683- print >>sys.stderr, ('Error: Configuration directory '
684- 'doesn\'t contain conf.py file.')
685- return 1
686- elif opt == '-C':
687- confdir = None
688- elif opt == '-D':
689- try:
690- key, val = val.split('=')
691- except ValueError:
692- print >>sys.stderr, ('Error: -D option argument must be '
693- 'in the form name=value.')
694- return 1
695- try:
696- val = int(val)
697- except ValueError:
698- if likely_encoding:
699- try:
700- val = val.decode(likely_encoding)
701- except UnicodeError:
702- pass
703- confoverrides[key] = val
704- elif opt == '-A':
705- try:
706- key, val = val.split('=')
707- except ValueError:
708- print >>sys.stderr, ('Error: -A option argument must be '
709- 'in the form name=value.')
710- return 1
711- try:
712- val = int(val)
713- except ValueError:
714- if likely_encoding:
715- try:
716- val = val.decode(likely_encoding)
717- except UnicodeError:
718- pass
719- confoverrides['html_context.%s' % key] = val
720- elif opt == '-n':
721- confoverrides['nitpicky'] = True
722- elif opt == '-N':
723- nocolor()
724- elif opt == '-E':
725- freshenv = True
726- elif opt == '-q':
727- status = None
728- elif opt == '-Q':
729- status = None
730- warning = None
731- elif opt == '-W':
732- warningiserror = True
733- elif opt == '-w':
734- warnfile = val
735- elif opt == '-P':
736- use_pdb = True
737-
738- if warning and warnfile:
739- warnfp = open(warnfile, 'w')
740- warning = Tee(warning, warnfp)
741- error = warning
742-
743- try:
744- app = Sphinx(srcdir, confdir, outdir, doctreedir, buildername,
745- confoverrides, status, warning, freshenv,
746- warningiserror, tags)
747- app.build(force_all, filenames)
748- return app.statuscode
749- except KeyboardInterrupt:
750- if use_pdb:
751- import pdb
752- print >>error, red('Interrupted while building, starting debugger:')
753- traceback.print_exc()
754- pdb.post_mortem(sys.exc_info()[2])
755- return 1
756- except Exception, err:
757- if use_pdb:
758- import pdb
759- print >>error, red('Exception occurred while building, '
760- 'starting debugger:')
761- traceback.print_exc()
762- pdb.post_mortem(sys.exc_info()[2])
763- else:
764- print >>error
765- if isinstance(err, SystemMessage):
766- print >>error, red('reST markup error:')
767- print >>error, terminal_safe(err.args[0])
768- elif isinstance(err, SphinxError):
769- print >>error, red('%s:' % err.category)
770- print >>error, terminal_safe(unicode(err))
771- else:
772- print >>error, red('Exception occurred:')
773- print >>error, format_exception_cut_frames().rstrip()
774- tbpath = save_traceback()
775- print >>error, red('The full traceback has been saved '
776- 'in %s, if you want to report the '
777- 'issue to the developers.' % tbpath)
778- print >>error, ('Please also report this if it was a user '
779- 'error, so that a better error message '
780- 'can be provided next time.')
781- print >>error, (
782- 'Either send bugs to the mailing list at '
783- '<http://groups.google.com/group/sphinx-dev/>,\n'
784- 'or report them in the tracker at '
785- '<http://bitbucket.org/birkenfeld/sphinx/issues/>. Thanks!')
786- return 1
787
788=== removed directory '.pc/sphinxcontrib_namespace.diff'
789=== removed directory '.pc/sphinxcontrib_namespace.diff/sphinx'
790=== removed file '.pc/sphinxcontrib_namespace.diff/sphinx/__init__.py'
791--- .pc/sphinxcontrib_namespace.diff/sphinx/__init__.py 2012-02-03 13:52:49 +0000
792+++ .pc/sphinxcontrib_namespace.diff/sphinx/__init__.py 1970-01-01 00:00:00 +0000
793@@ -1,76 +0,0 @@
794-# -*- coding: utf-8 -*-
795-"""
796- Sphinx
797- ~~~~~~
798-
799- The Sphinx documentation toolchain.
800-
801- :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
802- :license: BSD, see LICENSE for details.
803-"""
804-
805-# Keep this file executable as-is in Python 3!
806-# (Otherwise getting the version out of it from setup.py is impossible.)
807-
808-import sys
809-from os import path
810-
811-__version__ = '1.1.2'
812-__released__ = '1.1.2' # used when Sphinx builds its own docs
813-
814-package_dir = path.abspath(path.dirname(__file__))
815-
816-if '+' in __version__ or 'pre' in __version__:
817- # try to find out the changeset hash if checked out from hg, and append
818- # it to __version__ (since we use this value from setup.py, it gets
819- # automatically propagated to an installed copy as well)
820- try:
821- import subprocess
822- p = subprocess.Popen(['hg', 'id', '-i', '-R',
823- path.join(package_dir, '..')],
824- stdout=subprocess.PIPE, stderr=subprocess.PIPE)
825- out, err = p.communicate()
826- if out:
827- __version__ += '/' + out.strip()
828- except Exception:
829- pass
830-
831-
832-def main(argv=sys.argv):
833- """Sphinx build "main" command-line entry."""
834- if sys.version_info[:3] < (2, 4, 0):
835- sys.stderr.write('Error: Sphinx requires at least '
836- 'Python 2.4 to run.\n')
837- return 1
838-
839- try:
840- from sphinx import cmdline
841- except ImportError:
842- err = sys.exc_info()[1]
843- errstr = str(err)
844- if errstr.lower().startswith('no module named'):
845- whichmod = errstr[16:]
846- hint = ''
847- if whichmod.startswith('docutils'):
848- whichmod = 'Docutils library'
849- elif whichmod.startswith('jinja'):
850- whichmod = 'Jinja2 library'
851- elif whichmod == 'roman':
852- whichmod = 'roman module (which is distributed with Docutils)'
853- hint = ('This can happen if you upgraded docutils using\n'
854- 'easy_install without uninstalling the old version'
855- 'first.\n')
856- else:
857- whichmod += ' module'
858- sys.stderr.write('Error: The %s cannot be found. '
859- 'Did you install Sphinx and its dependencies '
860- 'correctly?\n' % whichmod)
861- if hint:
862- sys.stderr.write(hint)
863- return 1
864- raise
865- return cmdline.main(argv)
866-
867-
868-if __name__ == '__main__':
869- sys.exit(main(sys.argv))
870
871=== removed directory '.pc/unversioned_grammar_pickle.diff'
872=== removed directory '.pc/unversioned_grammar_pickle.diff/sphinx'
873=== removed directory '.pc/unversioned_grammar_pickle.diff/sphinx/pycode'
874=== removed directory '.pc/unversioned_grammar_pickle.diff/sphinx/pycode/pgen2'
875=== removed file '.pc/unversioned_grammar_pickle.diff/sphinx/pycode/pgen2/driver.py'
876--- .pc/unversioned_grammar_pickle.diff/sphinx/pycode/pgen2/driver.py 2011-09-28 17:20:22 +0000
877+++ .pc/unversioned_grammar_pickle.diff/sphinx/pycode/pgen2/driver.py 1970-01-01 00:00:00 +0000
878@@ -1,145 +0,0 @@
879-# Copyright 2004-2005 Elemental Security, Inc. All Rights Reserved.
880-# Licensed to PSF under a Contributor Agreement.
881-
882-# Modifications:
883-# Copyright 2006 Google, Inc. All Rights Reserved.
884-# Licensed to PSF under a Contributor Agreement.
885-
886-"""Parser driver.
887-
888-This provides a high-level interface to parse a file into a syntax tree.
889-
890-"""
891-
892-__author__ = "Guido van Rossum <guido@python.org>"
893-
894-__all__ = ["Driver", "load_grammar"]
895-
896-# Python imports
897-import os
898-import logging
899-import sys
900-
901-# Pgen imports
902-from sphinx.pycode.pgen2 import grammar, parse, token, tokenize, pgen
903-
904-
905-class Driver(object):
906-
907- def __init__(self, grammar, convert=None, logger=None):
908- self.grammar = grammar
909- if logger is None:
910- logger = logging.getLogger()
911- self.logger = logger
912- self.convert = convert
913-
914- def parse_tokens(self, tokens, debug=False):
915- """Parse a series of tokens and return the syntax tree."""
916- # X X X Move the prefix computation into a wrapper around tokenize.
917- p = parse.Parser(self.grammar, self.convert)
918- p.setup()
919- lineno = 1
920- column = 0
921- type = value = start = end = line_text = None
922- prefix = ""
923- opmap = grammar.opmap
924- for type, value, start, end, line_text in tokens:
925- if start != (lineno, column):
926- assert (lineno, column) <= start, ((lineno, column), start)
927- s_lineno, s_column = start
928- if lineno < s_lineno:
929- prefix += "\n" * (s_lineno - lineno)
930- lineno = s_lineno
931- column = 0
932- if column < s_column:
933- prefix += line_text[column:s_column]
934- column = s_column
935- if type in (tokenize.COMMENT, tokenize.NL):
936- prefix += value
937- lineno, column = end
938- if value.endswith("\n"):
939- lineno += 1
940- column = 0
941- continue
942- if type == token.OP:
943- type = opmap[value]
944- # if debug:
945- # self.logger.debug("%s %r (prefix=%r)",
946- # token.tok_name[type], value, prefix)
947- if p.addtoken(type, value, (prefix, start)):
948- # if debug:
949- # self.logger.debug("Stop.")
950- break
951- prefix = ""
952- lineno, column = end
953- if value.endswith("\n"):
954- lineno += 1
955- column = 0
956- else:
957- # We never broke out -- EOF is too soon (how can this happen???)
958- raise parse.ParseError("incomplete input", type, value, line_text)
959- return p.rootnode
960-
961- def parse_stream_raw(self, stream, debug=False):
962- """Parse a stream and return the syntax tree."""
963- tokens = tokenize.generate_tokens(stream.readline)
964- return self.parse_tokens(tokens, debug)
965-
966- def parse_stream(self, stream, debug=False):
967- """Parse a stream and return the syntax tree."""
968- return self.parse_stream_raw(stream, debug)
969-
970- def parse_file(self, filename, debug=False):
971- """Parse a file and return the syntax tree."""
972- stream = open(filename)
973- try:
974- return self.parse_stream(stream, debug)
975- finally:
976- stream.close()
977-
978- def parse_string(self, text, debug=False):
979- """Parse a string and return the syntax tree."""
980- tokens = tokenize.generate_tokens(generate_lines(text).next)
981- return self.parse_tokens(tokens, debug)
982-
983-
984-def generate_lines(text):
985- """Generator that behaves like readline without using StringIO."""
986- for line in text.splitlines(True):
987- yield line
988- while True:
989- yield ""
990-
991-
992-def load_grammar(gt="Grammar.txt", gp=None,
993- save=True, force=False, logger=None):
994- """Load the grammar (maybe from a pickle)."""
995- if logger is None:
996- logger = logging.getLogger()
997- if gp is None:
998- head, tail = os.path.splitext(gt)
999- if tail == ".txt":
1000- tail = ""
1001- gp = head + tail + ".".join(map(str, sys.version_info[:2])) + ".pickle"
1002- if force or not _newer(gp, gt):
1003- logger.info("Generating grammar tables from %s", gt)
1004- g = pgen.generate_grammar(gt)
1005- if save:
1006- logger.info("Writing grammar tables to %s", gp)
1007- try:
1008- g.dump(gp)
1009- except IOError, e:
1010- logger.info("Writing failed:"+str(e))
1011- else:
1012- g = grammar.Grammar()
1013- g.load(gp)
1014- return g
1015-
1016-
1017-def _newer(a, b):
1018- """Inquire whether file a was written since file b."""
1019- if not os.path.exists(a):
1020- return False
1021- if not os.path.exists(b):
1022- return True
1023- return os.path.getmtime(a) >= os.path.getmtime(b)
1024
1025=== modified file 'CHANGES'
1026--- CHANGES 2012-02-05 19:33:59 +0000
1027+++ CHANGES 2012-03-27 21:09:18 +0000
1028@@ -1,3 +1,61 @@
1029+Release 1.1.3 (Mar 10, 2012)
1030+============================
1031+
1032+* PR#40: Fix ``safe_repr`` function to decode bytestrings with non-ASCII
1033+ characters correctly.
1034+
1035+* PR#37: Allow configuring sphinx-apidoc via ``SPHINX_APIDOC_OPTIONS``.
1036+
1037+* PR#34: Restore Python 2.4 compatibility.
1038+
1039+* PR#36: Make the "bibliography to TOC" fix in LaTeX output specific to
1040+ the document class.
1041+
1042+* #695: When the highlight language "python" is specified explicitly,
1043+ do not try to parse the code to recognize non-Python snippets.
1044+
1045+* #859: Fix exception under certain circumstances when not finding
1046+ appropriate objects to link to.
1047+
1048+* #860: Do not crash when encountering invalid doctest examples, just
1049+ emit a warning.
1050+
1051+* #864: Fix crash with some settings of :confval:`modindex_common_prefix`.
1052+
1053+* #862: Fix handling of ``-D`` and ``-A`` options on Python 3.
1054+
1055+* #851: Recognize and warn about circular toctrees, instead of running
1056+ into recursion errors.
1057+
1058+* #853: Restore compatibility with docutils trunk.
1059+
1060+* #852: Fix HtmlHelp index entry links again.
1061+
1062+* #854: Fix inheritance_diagram raising attribute errors on builtins.
1063+
1064+* #832: Fix crashes when putting comments or lone terms in a glossary.
1065+
1066+* #834, #818: Fix HTML help language/encoding mapping for all Sphinx
1067+ supported languages.
1068+
1069+* #844: Fix crashes when dealing with Unicode output in doctest extension.
1070+
1071+* #831: Provide ``--project`` flag in setup_command as advertised.
1072+
1073+* #875: Fix reading config files under Python 3.
1074+
1075+* #876: Fix quickstart test under Python 3.
1076+
1077+* #870: Fix spurious KeyErrors when removing documents.
1078+
1079+* #892: Fix single-HTML builder misbehaving with the master document in a
1080+ subdirectory.
1081+
1082+* #873: Fix assertion errors with empty ``only`` directives.
1083+
1084+* #816: Fix encoding issues in the Qt help builder.
1085+
1086+
1087 Release 1.1.2 (Nov 1, 2011) -- 1.1.1 is a silly version number anyway!
1088 ======================================================================
1089
1090
1091=== modified file 'PKG-INFO'
1092--- PKG-INFO 2012-02-05 19:33:59 +0000
1093+++ PKG-INFO 2012-03-27 21:09:18 +0000
1094@@ -1,6 +1,6 @@
1095-Metadata-Version: 1.1
1096+Metadata-Version: 1.0
1097 Name: Sphinx
1098-Version: 1.1.2
1099+Version: 1.1.3
1100 Summary: Python documentation generator
1101 Home-page: http://sphinx.pocoo.org/
1102 Author: Georg Brandl
1103
1104=== modified file 'Sphinx.egg-info/PKG-INFO'
1105--- Sphinx.egg-info/PKG-INFO 2012-02-05 19:33:59 +0000
1106+++ Sphinx.egg-info/PKG-INFO 2012-03-27 21:09:18 +0000
1107@@ -1,6 +1,6 @@
1108-Metadata-Version: 1.1
1109+Metadata-Version: 1.0
1110 Name: Sphinx
1111-Version: 1.1.2
1112+Version: 1.1.3
1113 Summary: Python documentation generator
1114 Home-page: http://sphinx.pocoo.org/
1115 Author: Georg Brandl
1116
1117=== modified file 'debian/changelog'
1118--- debian/changelog 2012-03-13 12:34:01 +0000
1119+++ debian/changelog 2012-03-27 21:09:18 +0000
1120@@ -1,3 +1,55 @@
1121+sphinx (1.1.3+dfsg-2ubuntu1) precise; urgency=low
1122+
1123+ * Merge from Debian Testing. Remaining Ubuntu changes:
1124+ - Switch to dh_python2.
1125+ - debian/rules: export NO_PKG_MANGLE=1 in order to
1126+ not have translations stripped.
1127+ - debian/control: Drop the dependency on python-whoosh.
1128+
1129+ -- Andrew Starr-Bochicchio <a.starr.b@gmail.com> Tue, 27 Mar 2012 16:25:04 -0400
1130+
1131+sphinx (1.1.3+dfsg-2) unstable; urgency=low
1132+
1133+ * Upload to unstable.
1134+ * Add skiptest_latex.diff: if LaTeX (or a required LaTeX package) is not
1135+ found when running test_build_latex, raise SkipTest instead of just
1136+ printing a message to stderr.
1137+
1138+ -- Jakub Wilk <jwilk@debian.org> Wed, 14 Mar 2012 20:31:19 +0100
1139+
1140+sphinx (1.1.3+dfsg-1) experimental; urgency=low
1141+
1142+ * New upstream release.
1143+ + Drop python3_test_syspath.diff, applied upstream.
1144+ + Update integration tests for the JavaScript code.
1145+ * Bump standards version to 3.9.3 (no changes needed).
1146+
1147+ -- Jakub Wilk <jwilk@debian.org> Mon, 12 Mar 2012 12:18:37 +0100
1148+
1149+sphinx (1.1.2+dfsg-5) unstable; urgency=low
1150+
1151+ * Don't run ‘python setup.py clean’ in the clean target (we nuke the whole
1152+ build subdirectory anyway).
1153+ * Move python-all and python-setuptools from Build-Depends to
1154+ Build-Depends-Indep, as it's not needed in the clean target anymore.
1155+ * Don't run dh_testroot in the clean target. There's a good chance that root
1156+ privileges are not needed (e.g. because binary target was run under
1157+ fakeroot), and even if they are actually needed, the target will fail
1158+ quickly.
1159+ * Run tests against Python 3:
1160+ + Add build-dependency on python3-nose, python3-docutils,
1161+ python3-pygments, python3-jinja2, python3-sqlalchemy.
1162+ + Add python3_test_syspath.diff to fix Python 3 sys.path for the test
1163+ runner.
1164+ + Add python3_test_build_dir.diff to hardcode Python 3 build directory in
1165+ the test runner to the one that the package uses.
1166+ + Add test running code debian/rules. Don't use --no-skip for the moment,
1167+ as some required packages don't exist yet (see #647441, #647439). Set
1168+ LC_ALL=C.UTF-8 to work around failures under LC_ALL=C (see
1169+ <http://deb.li/H8ED> and <http://deb.li/3Rw0z>).
1170+
1171+ -- Jakub Wilk <jwilk@debian.org> Tue, 14 Feb 2012 00:13:35 +0100
1172+
1173 sphinx (1.1.2+dfsg-4ubuntu3) precise; urgency=low
1174
1175 * debian/rules: export NO_PKG_MANGLE=1 in order to
1176@@ -269,7 +321,7 @@
1177 sphinx (0.6.6-2) unstable; urgency=low
1178
1179 * Team upload.
1180-
1181+
1182 [ Mikhail Gusarov ]
1183 * Fix preinst script to correctly remove python-central remnants (Closes:
1184 #559572).
1185
1186=== modified file 'debian/control'
1187--- debian/control 2012-02-21 19:55:03 +0000
1188+++ debian/control 2012-03-27 21:09:18 +0000
1189@@ -5,21 +5,23 @@
1190 XSBC-Original-Maintainer: Jakub Wilk <jwilk@debian.org>
1191 Uploaders: Debian Python Modules Team <python-modules-team@lists.alioth.debian.org>
1192 Homepage: http://sphinx.pocoo.org/
1193-Build-Depends: debhelper (>= 7), python-all (>= 2.5.4-1~), python-setuptools (>= 0.6c5-1~)
1194-Build-Depends-Indep:
1195- python3 (>= 3.1.2-7~), python3-setuptools,
1196- python-docutils (>= 0.7),
1197- python-pygments (>= 1.2),
1198- python-jinja2 (>= 2.3),
1199- python-sqlalchemy,
1200+Build-Depends: debhelper (>= 7)
1201+Build-Depends-Indep: python-support (>= 0.6.4),
1202+ python-all (>= 2.5.4-1~), python3 (>= 3.1.2-7~),
1203+ python-setuptools (>= 0.6c5-1~), python3-setuptools,
1204+ python-docutils (>= 0.7), python3-docutils (>= 0.7),
1205+ python-pygments (>= 1.2), python3-pygments (>= 1.2),
1206+ python-jinja2 (>= 2.3), python3-jinja2 (>= 2.3),
1207+ python-sqlalchemy, python3-sqlalchemy,
1208 python-xapian,
1209- python-nose, python (>= 2.6.6-14~) | python-simplejson,
1210+ python-nose, python3-nose,
1211+ python (>= 2.6.6-14~) | python-simplejson,
1212 xvfb, xauth, python-webkit, libjs-jquery (>= 1.4), libjs-underscore,
1213 texlive-latex-recommended, texlive-latex-extra, texlive-fonts-recommended,
1214 perl
1215 XS-Python-Version: >= 2.5
1216 X-Python3-Version: >= 3.1
1217-Standards-Version: 3.9.2
1218+Standards-Version: 3.9.3
1219 Vcs-Svn: svn://svn.debian.org/python-modules/packages/sphinx/trunk/
1220 Vcs-Browser: http://svn.debian.org/viewsvn/python-modules/packages/sphinx/trunk/
1221
1222
1223=== modified file 'debian/jstest/run-tests'
1224--- debian/jstest/run-tests 2012-02-05 19:33:59 +0000
1225+++ debian/jstest/run-tests 2012-03-27 21:09:18 +0000
1226@@ -7,14 +7,14 @@
1227
1228 class t1:
1229 search_term = 'example'
1230- n_results = 34
1231- n_links = 34
1232+ n_results = 35
1233+ n_links = 35
1234 n_highlights = 32
1235
1236 class t2:
1237 search_term = 'examples'
1238- n_results = 34
1239- n_links = 34
1240+ n_results = 35
1241+ n_links = 35
1242 n_highlights = 6
1243
1244 class t3:
1245
1246=== added file 'debian/patches/python3_test_build_dir.diff'
1247--- debian/patches/python3_test_build_dir.diff 1970-01-01 00:00:00 +0000
1248+++ debian/patches/python3_test_build_dir.diff 2012-03-27 21:09:18 +0000
1249@@ -0,0 +1,23 @@
1250+Description: Fix build directory for test runner.
1251+ Hardcode Python 3 build directory in the test runner to the one that Debian
1252+ package uses.
1253+Author: Jakub Wilk <jwilk@debian.org>
1254+Forwarded: not-needed
1255+Last-Update: 2012-02-12
1256+
1257+--- a/tests/run.py
1258++++ b/tests/run.py
1259+@@ -14,11 +14,11 @@
1260+ from os import path, chdir, listdir
1261+
1262+ if sys.version_info >= (3, 0):
1263+- print('Copying and converting sources to build/lib/tests...')
1264++ print('Copying and converting sources to build/py3/tests...')
1265+ from distutils.util import copydir_run_2to3
1266+ testroot = path.dirname(__file__) or '.'
1267+ newroot = path.join(testroot, path.pardir, 'build')
1268+- newroot = path.join(newroot, listdir(newroot)[0], 'tests')
1269++ newroot = path.join(newroot, 'py3', 'tests')
1270+ copydir_run_2to3(testroot, newroot)
1271+ # switch to the converted dir so nose tests the right tests
1272+ chdir(newroot)
1273
1274=== modified file 'debian/patches/series'
1275--- debian/patches/series 2012-02-05 19:33:59 +0000
1276+++ debian/patches/series 2012-03-27 21:09:18 +0000
1277@@ -3,3 +3,5 @@
1278 show_more_stack_frames.diff
1279 initialize_autodoc.diff
1280 sphinxcontrib_namespace.diff
1281+python3_test_build_dir.diff
1282+skiptest_latex.diff
1283
1284=== added file 'debian/patches/skiptest_latex.diff'
1285--- debian/patches/skiptest_latex.diff 1970-01-01 00:00:00 +0000
1286+++ debian/patches/skiptest_latex.diff 2012-03-27 21:09:18 +0000
1287@@ -0,0 +1,42 @@
1288+Description: raise SkipTest if LaTeX (or a required LaTeX package) is not found
1289+ If LaTeX (or a required LaTeX package) is not found when running
1290+ test_build_latex, raise SkipTest instead of just printing a message to stderr.
1291+Author: Jakub Wilk <jwilk@debian.org>
1292+Bug: https://bitbucket.org/birkenfeld/sphinx/issue/896/test_build_latex-could-use-skiptest
1293+Forwarded: no
1294+Last-Update: 2012-03-13
1295+
1296+--- a/tests/test_build_latex.py
1297++++ b/tests/test_build_latex.py
1298+@@ -18,6 +18,7 @@
1299+ from sphinx.writers.latex import LaTeXTranslator
1300+
1301+ from util import *
1302++from util import SkipTest
1303+ from test_build_html import ENV_WARNINGS
1304+
1305+
1306+@@ -68,17 +69,17 @@
1307+ return True
1308+
1309+ if kpsetest('article.sty') is None:
1310+- print >>sys.stderr, \
1311+- 'info: not running latex, it doesn\'t seem to be installed'
1312+- return
1313++ raise SkipTest(
1314++ 'not running latex, it doesn\'t seem to be installed'
1315++ )
1316+ for filename in ['fancyhdr.sty', 'fancybox.sty', 'titlesec.sty',
1317+ 'amsmath.sty', 'framed.sty', 'color.sty', 'fancyvrb.sty',
1318+ 'threeparttable.sty']:
1319+ if not kpsetest(filename):
1320+- print >>sys.stderr, \
1321+- 'info: not running latex, the %s package doesn\'t ' \
1322++ raise SkipTest(
1323++ 'not running latex, the %s package doesn\'t ' \
1324+ 'seem to be installed' % filename
1325+- return
1326++ )
1327+
1328+ # now, try to run latex over it
1329+ cwd = os.getcwd()
1330
1331=== modified file 'debian/rules'
1332--- debian/rules 2012-03-13 12:34:01 +0000
1333+++ debian/rules 2012-03-27 21:09:18 +0000
1334@@ -20,6 +20,7 @@
1335 javascript_path = /usr/share/javascript/sphinxdoc/1.0/
1336
1337 python_all = pyversions -r | tr ' ' '\n' | xargs -t -I {} env {}
1338+python3_all = py3versions -r | tr ' ' '\n' | xargs -t -I {} env {}
1339
1340 build-arch:
1341
1342@@ -33,18 +34,18 @@
1343 rm -rf build/man
1344 cp -rl build/html build/man
1345 python ./sphinx-build.py -b man doc build/man
1346+ python setup.py build --build-lib build/py2/
1347+ python3 setup.py build --build-lib build/py3/
1348 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
1349 $(python_all) tests/run.py --verbose --no-skip
1350+ export LC_ALL=C.UTF-8 && $(python3_all) tests/run.py --verbose
1351+ cd build/py3/ && rm -rf tests/ sphinx/pycode/Grammar.pickle
1352 xvfb-run ./debian/jstest/run-tests
1353 endif
1354- python setup.py build --build-lib build/py2/
1355- python3 setup.py build --build-lib build/py3/
1356 touch build-stamp
1357
1358 clean:
1359 dh_testdir
1360- dh_testroot
1361- python setup.py clean
1362 find . -name '*.py[co]' -delete
1363 rm -rf build
1364 rm -f $(basename $(wildcard debian/*.in))
1365
1366=== modified file 'doc/ext/math.rst'
1367--- doc/ext/math.rst 2012-02-05 19:33:59 +0000
1368+++ doc/ext/math.rst 2012-03-27 21:09:18 +0000
1369@@ -24,6 +24,10 @@
1370 standard for plain-text math notation and has the added advantage that no
1371 further translation is necessary when building LaTeX output.
1372
1373+Keep in mind that when you put math markup in **Python docstrings** read by
1374+:mod:`autodoc <sphinx.ext.autodoc>`, you either have to double all backslashes,
1375+or use Python raw strings (``r"raw"``).
1376+
1377 :mod:`.mathbase` defines these new markup elements:
1378
1379 .. rst:role:: math
1380
1381=== modified file 'doc/markup/misc.rst'
1382--- doc/markup/misc.rst 2011-11-20 15:56:50 +0000
1383+++ doc/markup/misc.rst 2012-03-27 21:09:18 +0000
1384@@ -182,6 +182,13 @@
1385 The format of the current builder (``html``, ``latex`` or ``text``) is always
1386 set as a tag.
1387
1388+ .. note::
1389+
1390+ Due to docutils' specifics of parsing of directive content, you cannot put
1391+ a section with the same level as the main document heading inside an
1392+ ``only`` directive. Such sections will appear to be ignored in the parsed
1393+ document.
1394+
1395 .. versionadded:: 0.6
1396
1397
1398
1399=== modified file 'setup.cfg'
1400--- setup.cfg 2011-10-12 00:34:20 +0000
1401+++ setup.cfg 2012-03-27 21:09:18 +0000
1402@@ -1,22 +1,22 @@
1403+[compile_catalog]
1404+directory = sphinx/locale/
1405+domain = sphinx
1406+
1407+[update_catalog]
1408+domain = sphinx
1409+output_dir = sphinx/locale/
1410+input_file = sphinx/locale/sphinx.pot
1411+
1412 [egg_info]
1413 tag_build =
1414 tag_date = 0
1415 tag_svn_revision = 0
1416
1417-[aliases]
1418-release = egg_info -RDb ''
1419-
1420 [extract_messages]
1421+keywords = _ l_ lazy_gettext
1422 mapping_file = babel.cfg
1423 output_file = sphinx/locale/sphinx.pot
1424-keywords = _ l_ lazy_gettext
1425-
1426-[update_catalog]
1427-input_file = sphinx/locale/sphinx.pot
1428-domain = sphinx
1429-output_dir = sphinx/locale/
1430-
1431-[compile_catalog]
1432-domain = sphinx
1433-directory = sphinx/locale/
1434+
1435+[aliases]
1436+release = egg_info -RDb ''
1437
1438
1439=== modified file 'setup.py'
1440--- setup.py 2012-02-05 19:33:59 +0000
1441+++ setup.py 2012-03-27 21:09:18 +0000
1442@@ -2,7 +2,6 @@
1443 try:
1444 from setuptools import setup, find_packages
1445 except ImportError:
1446- raise
1447 import distribute_setup
1448 distribute_setup.use_setuptools()
1449 from setuptools import setup, find_packages
1450
1451=== modified file 'sphinx/__init__.py'
1452--- sphinx/__init__.py 2012-02-05 19:33:59 +0000
1453+++ sphinx/__init__.py 2012-03-27 21:09:18 +0000
1454@@ -15,8 +15,8 @@
1455 import sys
1456 from os import path
1457
1458-__version__ = '1.1.2'
1459-__released__ = '1.1.2' # used when Sphinx builds its own docs
1460+__version__ = '1.1.3'
1461+__released__ = '1.1.3' # used when Sphinx builds its own docs
1462
1463 package_dir = path.abspath(path.dirname(__file__))
1464
1465@@ -35,19 +35,6 @@
1466 except Exception:
1467 pass
1468
1469-def _create_sphinext_namespace():
1470- # Create namespace package "sphinxcontrib".
1471- import pkgutil
1472- module_type = type(sys)
1473- try:
1474- sphinxcontrib = sys.modules['sphinxcontrib']
1475- except LookupError:
1476- sphinxcontrib = module_type('sphinxcontrib')
1477- sphinxcontrib.__path__ = []
1478- sys.modules[sphinxcontrib.__name__] = sphinxcontrib
1479- sphinxcontrib.__path__ = pkgutil.extend_path(sphinxcontrib.__path__, sphinxcontrib.__name__)
1480-
1481-_create_sphinext_namespace()
1482
1483 def main(argv=sys.argv):
1484 """Sphinx build "main" command-line entry."""
1485
1486=== modified file 'sphinx/apidoc.py'
1487--- sphinx/apidoc.py 2011-11-20 15:56:50 +0000
1488+++ sphinx/apidoc.py 2012-03-27 21:09:18 +0000
1489@@ -20,12 +20,15 @@
1490 from os import path
1491
1492 # automodule options
1493-OPTIONS = [
1494- 'members',
1495- 'undoc-members',
1496- # 'inherited-members', # disabled because there's a bug in sphinx
1497- 'show-inheritance',
1498-]
1499+if 'SPHINX_APIDOC_OPTIONS' in os.environ:
1500+ OPTIONS = os.environ['SPHINX_APIDOC_OPTIONS'].split(',')
1501+else:
1502+ OPTIONS = [
1503+ 'members',
1504+ 'undoc-members',
1505+ # 'inherited-members', # disabled because there's a bug in sphinx
1506+ 'show-inheritance',
1507+ ]
1508
1509 INITPY = '__init__.py'
1510
1511
1512=== modified file 'sphinx/builders/changes.py'
1513--- sphinx/builders/changes.py 2011-11-20 15:56:50 +0000
1514+++ sphinx/builders/changes.py 2012-03-27 21:09:18 +0000
1515@@ -11,7 +11,6 @@
1516
1517 import codecs
1518 from os import path
1519-from cgi import escape
1520
1521 from sphinx import package_dir
1522 from sphinx.util import copy_static_entry
1523@@ -20,6 +19,7 @@
1524 from sphinx.builders import Builder
1525 from sphinx.util.osutil import ensuredir, os_path
1526 from sphinx.util.console import bold
1527+from sphinx.util.pycompat import htmlescape
1528
1529
1530 class ChangesBuilder(Builder):
1531@@ -115,7 +115,7 @@
1532 '.. deprecated:: %s' % version]
1533
1534 def hl(no, line):
1535- line = '<a name="L%s"> </a>' % no + escape(line)
1536+ line = '<a name="L%s"> </a>' % no + htmlescape(line)
1537 for x in hltext:
1538 if x in line:
1539 line = '<span class="hl">%s</span>' % line
1540@@ -125,7 +125,10 @@
1541 self.info(bold('copying source files...'))
1542 for docname in self.env.all_docs:
1543 f = codecs.open(self.env.doc2path(docname), 'r', 'latin1')
1544- lines = f.readlines()
1545+ try:
1546+ lines = f.readlines()
1547+ finally:
1548+ f.close()
1549 targetfn = path.join(self.outdir, 'rst', os_path(docname)) + '.html'
1550 ensuredir(path.dirname(targetfn))
1551 f = codecs.open(targetfn, 'w', 'latin1')
1552@@ -148,7 +151,7 @@
1553 self.outdir, self)
1554
1555 def hl(self, text, version):
1556- text = escape(text)
1557+ text = htmlescape(text)
1558 for directive in ['versionchanged', 'versionadded', 'deprecated']:
1559 text = text.replace('.. %s:: %s' % (directive, version),
1560 '<b>.. %s:: %s</b>' % (directive, version))
1561
1562=== modified file 'sphinx/builders/html.py'
1563--- sphinx/builders/html.py 2011-11-20 15:56:50 +0000
1564+++ sphinx/builders/html.py 2012-03-27 21:09:18 +0000
1565@@ -698,9 +698,12 @@
1566 ctx = self.globalcontext.copy()
1567 # current_page_name is backwards compatibility
1568 ctx['pagename'] = ctx['current_page_name'] = pagename
1569+ default_baseuri = self.get_target_uri(pagename)
1570+ # in the singlehtml builder, default_baseuri still contains an #anchor
1571+ # part, which relative_uri doesn't really like...
1572+ default_baseuri = default_baseuri.rsplit('#', 1)[0]
1573
1574- def pathto(otheruri, resource=False,
1575- baseuri=self.get_target_uri(pagename)):
1576+ def pathto(otheruri, resource=False, baseuri=default_baseuri):
1577 if resource and '://' in otheruri:
1578 # allow non-local resources given by scheme
1579 return otheruri
1580
1581=== modified file 'sphinx/builders/htmlhelp.py'
1582--- sphinx/builders/htmlhelp.py 2011-11-20 15:56:50 +0000
1583+++ sphinx/builders/htmlhelp.py 2012-03-27 21:09:18 +0000
1584@@ -11,7 +11,6 @@
1585 """
1586
1587 import os
1588-import cgi
1589 import codecs
1590 from os import path
1591
1592@@ -19,6 +18,7 @@
1593
1594 from sphinx import addnodes
1595 from sphinx.builders.html import StandaloneHTMLBuilder
1596+from sphinx.util.pycompat import htmlescape
1597
1598
1599 # Project file (*.hhp) template. 'outname' is the file basename (like
1600@@ -124,20 +124,31 @@
1601 # See http://msdn.microsoft.com/en-us/library/ms930130.aspx for more.
1602 chm_locales = {
1603 # lang: LCID, encoding
1604- 'cs': (0x405, 'iso8859_2'),
1605- 'de': (0x407, 'iso8859_1'),
1606- 'en': (0x409, 'iso8859_1'),
1607- 'es': (0x40a, 'iso8859_1'),
1608- 'fi': (0x40b, 'iso8859_1'),
1609- 'fr': (0x40c, 'iso8859_1'),
1610- 'it': (0x410, 'iso8859_1'),
1611+ 'ca': (0x403, 'cp1252'),
1612+ 'cs': (0x405, 'cp1250'),
1613+ 'da': (0x406, 'cp1252'),
1614+ 'de': (0x407, 'cp1252'),
1615+ 'en': (0x409, 'cp1252'),
1616+ 'es': (0x40a, 'cp1252'),
1617+ 'et': (0x425, 'cp1257'),
1618+ 'fa': (0x429, 'cp1256'),
1619+ 'fi': (0x40b, 'cp1252'),
1620+ 'fr': (0x40c, 'cp1252'),
1621+ 'hr': (0x41a, 'cp1250'),
1622+ 'hu': (0x40e, 'cp1250'),
1623+ 'it': (0x410, 'cp1252'),
1624 'ja': (0x411, 'cp932'),
1625+ 'ko': (0x412, 'cp949'),
1626+ 'lt': (0x427, 'cp1257'),
1627 'lv': (0x426, 'cp1257'),
1628- 'nl': (0x413, 'iso8859_1'),
1629- 'pl': (0x415, 'iso8859_2'),
1630- 'pt_BR': (0x416, 'iso8859_1'),
1631+ 'nl': (0x413, 'cp1252'),
1632+ 'pl': (0x415, 'cp1250'),
1633+ 'pt_BR': (0x416, 'cp1252'),
1634 'ru': (0x419, 'cp1251'),
1635- 'sl': (0x424, 'iso8859_2'),
1636+ 'sk': (0x41b, 'cp1250'),
1637+ 'sl': (0x424, 'cp1250'),
1638+ 'sv': (0x41d, 'cp1252'),
1639+ 'tr': (0x41f, 'cp1254'),
1640 'uk_UA': (0x422, 'cp1251'),
1641 'zh_CN': (0x804, 'cp936'),
1642 'zh_TW': (0x404, 'cp950'),
1643@@ -230,7 +241,7 @@
1644 write_toc(subnode, ullevel)
1645 elif isinstance(node, nodes.reference):
1646 link = node['refuri']
1647- title = cgi.escape(node.astext()).replace('"','&quot;')
1648+ title = htmlescape(node.astext()).replace('"','&quot;')
1649 f.write(object_sitemap % (title, link))
1650 elif isinstance(node, nodes.bullet_list):
1651 if ullevel != 0:
1652@@ -259,20 +270,20 @@
1653 def write_index(title, refs, subitems):
1654 def write_param(name, value):
1655 item = ' <param name="%s" value="%s">\n' % \
1656- (name, value[1])
1657+ (name, value)
1658 f.write(item)
1659- title = cgi.escape(title)
1660+ title = htmlescape(title)
1661 f.write('<LI> <OBJECT type="text/sitemap">\n')
1662 write_param('Keyword', title)
1663 if len(refs) == 0:
1664 write_param('See Also', title)
1665 elif len(refs) == 1:
1666- write_param('Local', refs[0])
1667+ write_param('Local', refs[0][1])
1668 else:
1669 for i, ref in enumerate(refs):
1670 # XXX: better title?
1671- write_param('Name', '[%d] %s' % (i, ref))
1672- write_param('Local', ref)
1673+ write_param('Name', '[%d] %s' % (i, ref[1]))
1674+ write_param('Local', ref[1])
1675 f.write('</OBJECT>\n')
1676 if subitems:
1677 f.write('<UL> ')
1678
1679=== modified file 'sphinx/builders/qthelp.py'
1680--- sphinx/builders/qthelp.py 2011-11-20 15:56:50 +0000
1681+++ sphinx/builders/qthelp.py 2012-03-27 21:09:18 +0000
1682@@ -14,12 +14,13 @@
1683 import codecs
1684 import posixpath
1685 from os import path
1686-from cgi import escape
1687
1688 from docutils import nodes
1689
1690 from sphinx import addnodes
1691 from sphinx.builders.html import StandaloneHTMLBuilder
1692+from sphinx.util import force_decode
1693+from sphinx.util.pycompat import htmlescape
1694
1695
1696 _idpattern = re.compile(
1697@@ -130,16 +131,16 @@
1698 for indexname, indexcls, content, collapse in self.domain_indices:
1699 item = section_template % {'title': indexcls.localname,
1700 'ref': '%s.html' % indexname}
1701- sections.append((' ' * 4 * 4 + item).encode('utf-8'))
1702+ sections.append(' ' * 4 * 4 + item)
1703 # sections may be unicode strings or byte strings, we have to make sure
1704- # they are all byte strings before joining them
1705+ # they are all unicode strings before joining them
1706 new_sections = []
1707 for section in sections:
1708- if isinstance(section, unicode):
1709- new_sections.append(section.encode('utf-8'))
1710+ if not isinstance(section, unicode):
1711+ new_sections.append(force_decode(section, None))
1712 else:
1713 new_sections.append(section)
1714- sections = u'\n'.encode('utf-8').join(new_sections)
1715+ sections = u'\n'.join(new_sections)
1716
1717 # keywords
1718 keywords = []
1719@@ -147,7 +148,7 @@
1720 for (key, group) in index:
1721 for title, (refs, subitems) in group:
1722 keywords.extend(self.build_keywords(title, refs, subitems))
1723- keywords = '\n'.join(keywords)
1724+ keywords = u'\n'.join(keywords)
1725
1726 # files
1727 if not outdir.endswith(os.sep):
1728@@ -164,7 +165,7 @@
1729 fn.endswith('.html'):
1730 filename = path.join(root, fn)[olen:]
1731 projectfiles.append(file_template %
1732- {'filename': escape(filename)})
1733+ {'filename': htmlescape(filename)})
1734 projectfiles = '\n'.join(projectfiles)
1735
1736 # it seems that the "namespace" may not contain non-alphanumeric
1737@@ -179,12 +180,12 @@
1738 f = codecs.open(path.join(outdir, outname+'.qhp'), 'w', 'utf-8')
1739 try:
1740 f.write(project_template % {
1741- 'outname': escape(outname),
1742- 'title': escape(self.config.html_title),
1743- 'version': escape(self.config.version),
1744- 'project': escape(self.config.project),
1745- 'namespace': escape(nspace),
1746- 'masterdoc': escape(self.config.master_doc),
1747+ 'outname': htmlescape(outname),
1748+ 'title': htmlescape(self.config.html_title),
1749+ 'version': htmlescape(self.config.version),
1750+ 'project': htmlescape(self.config.project),
1751+ 'namespace': htmlescape(nspace),
1752+ 'masterdoc': htmlescape(self.config.master_doc),
1753 'sections': sections,
1754 'keywords': keywords,
1755 'files': projectfiles})
1756@@ -199,10 +200,10 @@
1757 f = codecs.open(path.join(outdir, outname+'.qhcp'), 'w', 'utf-8')
1758 try:
1759 f.write(collection_template % {
1760- 'outname': escape(outname),
1761- 'title': escape(self.config.html_short_title),
1762- 'homepage': escape(homepage),
1763- 'startpage': escape(startpage)})
1764+ 'outname': htmlescape(outname),
1765+ 'title': htmlescape(self.config.html_short_title),
1766+ 'homepage': htmlescape(homepage),
1767+ 'startpage': htmlescape(startpage)})
1768 finally:
1769 f.close()
1770
1771@@ -220,14 +221,14 @@
1772 return True
1773
1774 def write_toc(self, node, indentlevel=4):
1775+ # XXX this should return a Unicode string, not a bytestring
1776 parts = []
1777 if self.isdocnode(node):
1778 refnode = node.children[0][0]
1779 link = refnode['refuri']
1780- title = escape(refnode.astext()).replace('"','&quot;')
1781- item = '<section title="%(title)s" ref="%(ref)s">' % {
1782- 'title': title,
1783- 'ref': link}
1784+ title = htmlescape(refnode.astext()).replace('"', '&quot;')
1785+ item = '<section title="%(title)s" ref="%(ref)s">' % \
1786+ {'title': title, 'ref': link}
1787 parts.append(' '*4*indentlevel + item)
1788 for subnode in node.children[1]:
1789 parts.extend(self.write_toc(subnode, indentlevel+1))
1790@@ -237,7 +238,7 @@
1791 parts.extend(self.write_toc(subnode, indentlevel))
1792 elif isinstance(node, nodes.reference):
1793 link = node['refuri']
1794- title = escape(node.astext()).replace('"','&quot;')
1795+ title = htmlescape(node.astext()).replace('"','&quot;')
1796 item = section_template % {'title': title, 'ref': link}
1797 item = u' ' * 4 * indentlevel + item
1798 parts.append(item.encode('ascii', 'xmlcharrefreplace'))
1799@@ -274,7 +275,7 @@
1800 def build_keywords(self, title, refs, subitems):
1801 keywords = []
1802
1803- title = escape(title)
1804+ title = htmlescape(title)
1805 # if len(refs) == 0: # XXX
1806 # write_param('See Also', title)
1807 if len(refs) == 1:
1808
1809=== modified file 'sphinx/cmdline.py'
1810--- sphinx/cmdline.py 2012-02-05 19:33:59 +0000
1811+++ sphinx/cmdline.py 2012-03-27 21:09:18 +0000
1812@@ -22,7 +22,7 @@
1813 from sphinx.application import Sphinx
1814 from sphinx.util import Tee, format_exception_cut_frames, save_traceback
1815 from sphinx.util.console import red, nocolor, color_terminal
1816-from sphinx.util.pycompat import terminal_safe
1817+from sphinx.util.pycompat import terminal_safe, bytes
1818
1819
1820 def usage(argv, msg=None):
1821@@ -137,7 +137,7 @@
1822 try:
1823 val = int(val)
1824 except ValueError:
1825- if likely_encoding:
1826+ if likely_encoding and isinstance(val, bytes):
1827 try:
1828 val = val.decode(likely_encoding)
1829 except UnicodeError:
1830@@ -153,7 +153,7 @@
1831 try:
1832 val = int(val)
1833 except ValueError:
1834- if likely_encoding:
1835+ if likely_encoding and isinstance(val, bytes):
1836 try:
1837 val = val.decode(likely_encoding)
1838 except UnicodeError:
1839@@ -212,7 +212,7 @@
1840 print >>error, terminal_safe(unicode(err))
1841 else:
1842 print >>error, red('Exception occurred:')
1843- print >>error, format_exception_cut_frames(10).rstrip()
1844+ print >>error, format_exception_cut_frames().rstrip()
1845 tbpath = save_traceback()
1846 print >>error, red('The full traceback has been saved '
1847 'in %s, if you want to report the '
1848
1849=== modified file 'sphinx/config.py'
1850--- sphinx/config.py 2012-02-05 19:33:59 +0000
1851+++ sphinx/config.py 2012-03-27 21:09:18 +0000
1852@@ -194,8 +194,9 @@
1853 # we promise to have the config dir as current dir while the
1854 # config file is executed
1855 os.chdir(dirname)
1856- # get config source
1857- f = open(config_file, 'rU')
1858+ # get config source -- 'b' is a no-op under 2.x, while 'U' is
1859+ # ignored under 3.x (but 3.x compile() accepts \r\n newlines)
1860+ f = open(config_file, 'rbU')
1861 try:
1862 source = f.read()
1863 finally:
1864
1865=== modified file 'sphinx/domains/cpp.py'
1866--- sphinx/domains/cpp.py 2011-11-20 15:56:50 +0000
1867+++ sphinx/domains/cpp.py 2012-03-27 21:09:18 +0000
1868@@ -34,10 +34,10 @@
1869 _operator_re = re.compile(r'''(?x)
1870 \[\s*\]
1871 | \(\s*\)
1872- | [!<>=/*%+|&^-]=?
1873 | \+\+ | --
1874- | (<<|>>)=? | ~ | && | \| | \|\|
1875 | ->\*? | \,
1876+ | (<<|>>)=? | && | \|\|
1877+ | [!<>=/*%+|&^~-]=?
1878 ''')
1879
1880 _id_shortwords = {
1881
1882=== modified file 'sphinx/domains/python.py'
1883--- sphinx/domains/python.py 2011-11-20 15:56:50 +0000
1884+++ sphinx/domains/python.py 2012-03-27 21:09:18 +0000
1885@@ -525,7 +525,8 @@
1886 # it's a submodule
1887 if prev_modname == package:
1888 # first submodule - make parent a group head
1889- entries[-1][1] = 1
1890+ if entries:
1891+ entries[-1][1] = 1
1892 elif not prev_modname.startswith(package):
1893 # submodule without parent in list, add dummy entry
1894 entries.append([stripped + package, 1, '', '', '', '', ''])
1895@@ -625,22 +626,23 @@
1896 newname = None
1897 if searchmode == 1:
1898 objtypes = self.objtypes_for_role(type)
1899- if modname and classname:
1900- fullname = modname + '.' + classname + '.' + name
1901- if fullname in objects and objects[fullname][1] in objtypes:
1902- newname = fullname
1903- if not newname:
1904- if modname and modname + '.' + name in objects and \
1905- objects[modname + '.' + name][1] in objtypes:
1906- newname = modname + '.' + name
1907- elif name in objects and objects[name][1] in objtypes:
1908- newname = name
1909- else:
1910- # "fuzzy" searching mode
1911- searchname = '.' + name
1912- matches = [(oname, objects[oname]) for oname in objects
1913- if oname.endswith(searchname)
1914- and objects[oname][1] in objtypes]
1915+ if objtypes is not None:
1916+ if modname and classname:
1917+ fullname = modname + '.' + classname + '.' + name
1918+ if fullname in objects and objects[fullname][1] in objtypes:
1919+ newname = fullname
1920+ if not newname:
1921+ if modname and modname + '.' + name in objects and \
1922+ objects[modname + '.' + name][1] in objtypes:
1923+ newname = modname + '.' + name
1924+ elif name in objects and objects[name][1] in objtypes:
1925+ newname = name
1926+ else:
1927+ # "fuzzy" searching mode
1928+ searchname = '.' + name
1929+ matches = [(oname, objects[oname]) for oname in objects
1930+ if oname.endswith(searchname)
1931+ and objects[oname][1] in objtypes]
1932 else:
1933 # NOTE: searching for exact match, object type is not considered
1934 if name in objects:
1935
1936=== modified file 'sphinx/domains/std.py'
1937--- sphinx/domains/std.py 2011-11-20 15:56:50 +0000
1938+++ sphinx/domains/std.py 2012-03-27 21:09:18 +0000
1939@@ -245,6 +245,9 @@
1940 continue
1941 # unindented line -> a term
1942 if line and not line[0].isspace():
1943+ # enable comments
1944+ if line.startswith('.. '):
1945+ continue
1946 # first term of definition
1947 if in_definition:
1948 if not was_empty:
1949@@ -315,7 +318,9 @@
1950 term += system_messages
1951
1952 defnode = nodes.definition()
1953- self.state.nested_parse(definition, definition.items[0][1], defnode)
1954+ if definition:
1955+ self.state.nested_parse(definition, definition.items[0][1],
1956+ defnode)
1957
1958 items.append((termtexts,
1959 nodes.definition_list_item('', term, defnode)))
1960
1961=== modified file 'sphinx/environment.py'
1962--- sphinx/environment.py 2012-02-05 19:33:59 +0000
1963+++ sphinx/environment.py 2012-03-27 21:09:18 +0000
1964@@ -1164,7 +1164,12 @@
1965
1966 def get_toc_for(self, docname, builder):
1967 """Return a TOC nodetree -- for use on the same page only!"""
1968- toc = self.tocs[docname].deepcopy()
1969+ try:
1970+ toc = self.tocs[docname].deepcopy()
1971+ except KeyError:
1972+ # the document does not exist anymore: return a dummy node that
1973+ # renders to nothing
1974+ return nodes.paragraph()
1975 self.process_only_nodes(toc, builder, docname)
1976 for node in toc.traverse(nodes.reference):
1977 node['refuri'] = node['anchorname'] or '#'
1978@@ -1313,12 +1318,14 @@
1979 subnode['iscurrent'] = True
1980 subnode = subnode.parent
1981
1982- def _entries_from_toctree(toctreenode, separate=False, subtree=False):
1983+ def _entries_from_toctree(toctreenode, parents,
1984+ separate=False, subtree=False):
1985 """Return TOC entries for a toctree node."""
1986 refs = [(e[0], str(e[1])) for e in toctreenode['entries']]
1987 entries = []
1988 for (title, ref) in refs:
1989 try:
1990+ refdoc = None
1991 if url_re.match(ref):
1992 reference = nodes.reference('', '', internal=False,
1993 refuri=ref, anchorname='',
1994@@ -1341,6 +1348,12 @@
1995 # don't show subitems
1996 toc = nodes.bullet_list('', item)
1997 else:
1998+ if ref in parents:
1999+ self.warn(ref, 'circular toctree references '
2000+ 'detected, ignoring: %s <- %s' %
2001+ (ref, ' <- '.join(parents)))
2002+ continue
2003+ refdoc = ref
2004 toc = self.tocs[ref].deepcopy()
2005 self.process_only_nodes(toc, builder, ref)
2006 if title and toc.children and len(toc.children) == 1:
2007@@ -1376,8 +1389,9 @@
2008 if not (toctreenode.get('hidden', False)
2009 and not includehidden):
2010 i = toctreenode.parent.index(toctreenode) + 1
2011- for item in _entries_from_toctree(toctreenode,
2012- subtree=True):
2013+ for item in _entries_from_toctree(
2014+ toctreenode, [refdoc] + parents,
2015+ subtree=True):
2016 toctreenode.parent.insert(i, item)
2017 i += 1
2018 toctreenode.parent.remove(toctreenode)
2019@@ -1398,7 +1412,7 @@
2020 # NOTE: previously, this was separate=True, but that leads to artificial
2021 # separation when two or more toctree entries form a logical unit, so
2022 # separating mode is no longer used -- it's kept here for history's sake
2023- tocentries = _entries_from_toctree(toctree, separate=False)
2024+ tocentries = _entries_from_toctree(toctree, [], separate=False)
2025 if not tocentries:
2026 return None
2027
2028@@ -1498,19 +1512,21 @@
2029 self.warn_node(msg % {'target': target}, node)
2030
2031 def process_only_nodes(self, doctree, builder, fromdocname=None):
2032+ # A comment on the comment() nodes being inserted: replacing by [] would
2033+ # result in a "Losing ids" exception if there is a target node before
2034+ # the only node, so we make sure docutils can transfer the id to
2035+ # something, even if it's just a comment and will lose the id anyway...
2036 for node in doctree.traverse(addnodes.only):
2037 try:
2038 ret = builder.tags.eval_condition(node['expr'])
2039 except Exception, err:
2040 self.warn_node('exception while evaluating only '
2041 'directive expression: %s' % err, node)
2042- node.replace_self(node.children)
2043+ node.replace_self(node.children or nodes.comment())
2044 else:
2045 if ret:
2046- node.replace_self(node.children)
2047+ node.replace_self(node.children or nodes.comment())
2048 else:
2049- # replacing by [] would result in an "Losing ids" exception
2050- # if there is a target node before the only node
2051 node.replace_self(nodes.comment())
2052
2053 def assign_section_numbers(self):
2054@@ -1686,7 +1702,11 @@
2055 def collect_relations(self):
2056 relations = {}
2057 getinc = self.toctree_includes.get
2058- def collect(parents, docname, previous, next):
2059+ def collect(parents, parents_set, docname, previous, next):
2060+ # circular relationship?
2061+ if docname in parents_set:
2062+ # we will warn about this in resolve_toctree()
2063+ return
2064 includes = getinc(docname)
2065 # previous
2066 if not previous:
2067@@ -1723,9 +1743,10 @@
2068 for subindex, args in enumerate(izip(includes,
2069 [None] + includes,
2070 includes[1:] + [None])):
2071- collect([(docname, subindex)] + parents, *args)
2072+ collect([(docname, subindex)] + parents,
2073+ parents_set.union([docname]), *args)
2074 relations[docname] = [parents[0][0], previous, next]
2075- collect([(None, 0)], self.config.master_doc, None, None)
2076+ collect([(None, 0)], set(), self.config.master_doc, None, None)
2077 return relations
2078
2079 def check_consistency(self):
2080
2081=== modified file 'sphinx/ext/autodoc.py'
2082--- sphinx/ext/autodoc.py 2012-02-05 19:33:59 +0000
2083+++ sphinx/ext/autodoc.py 2012-03-27 21:09:18 +0000
2084@@ -512,9 +512,13 @@
2085 # unbound method objects instead of function objects);
2086 # using keys() because apparently there are objects for which
2087 # __dict__ changes while getting attributes
2088- obj_dict = self.get_attr(self.object, '__dict__')
2089- members = [(mname, self.get_attr(self.object, mname, None))
2090- for mname in obj_dict.keys()]
2091+ try:
2092+ obj_dict = self.get_attr(self.object, '__dict__')
2093+ except AttributeError:
2094+ members = []
2095+ else:
2096+ members = [(mname, self.get_attr(self.object, mname, None))
2097+ for mname in obj_dict.keys()]
2098 membernames = set(m[0] for m in members)
2099 # add instance attributes from the analyzer
2100 if self.analyzer:
2101
2102=== modified file 'sphinx/ext/autosummary/generate.py'
2103--- sphinx/ext/autosummary/generate.py 2012-02-05 19:33:59 +0000
2104+++ sphinx/ext/autosummary/generate.py 2012-03-27 21:09:18 +0000
2105@@ -27,7 +27,6 @@
2106 from jinja2 import FileSystemLoader, TemplateNotFound
2107 from jinja2.sandbox import SandboxedEnvironment
2108
2109-from sphinx.ext import autodoc
2110 from sphinx import package_dir
2111 from sphinx.ext.autosummary import import_by_name, get_documenter
2112 from sphinx.jinja2glue import BuiltinTemplateLoader
2113@@ -51,15 +50,6 @@
2114 if len(args) < 1:
2115 p.error('no input files given')
2116
2117- class Sphinx(object):
2118- def add_autodocumenter(self, cls):
2119- autodoc.add_documenter(cls)
2120- def add_event(self, name):
2121- pass
2122- def add_config_value(self, name, default, rebuild):
2123- pass
2124- autodoc.setup(Sphinx())
2125-
2126 generate_autosummary_docs(args, options.output_dir,
2127 "." + options.suffix,
2128 template_dir=options.templates)
2129
2130=== modified file 'sphinx/ext/doctest.py'
2131--- sphinx/ext/doctest.py 2011-11-20 15:56:50 +0000
2132+++ sphinx/ext/doctest.py 2012-03-27 21:09:18 +0000
2133@@ -23,9 +23,11 @@
2134 from docutils.parsers.rst import directives
2135
2136 from sphinx.builders import Builder
2137+from sphinx.util import force_decode
2138 from sphinx.util.nodes import set_source_info
2139 from sphinx.util.compat import Directive
2140 from sphinx.util.console import bold
2141+from sphinx.util.pycompat import bytes
2142
2143 blankline_re = re.compile(r'^\s*<BLANKLINE>', re.MULTILINE)
2144 doctestopt_re = re.compile(r'#\s*doctest:.+$', re.MULTILINE)
2145@@ -231,6 +233,8 @@
2146 self.info(text, nonl=True)
2147 if self.app.quiet:
2148 self.warn(text)
2149+ if isinstance(text, bytes):
2150+ text = force_decode(text, None)
2151 self.outfile.write(text)
2152
2153 def get_target_uri(self, docname, typ=None):
2154@@ -375,8 +379,14 @@
2155 for code in group.tests:
2156 if len(code) == 1:
2157 # ordinary doctests (code/output interleaved)
2158- test = parser.get_doctest(code[0].code, {}, group.name,
2159- filename, code[0].lineno)
2160+ try:
2161+ test = parser.get_doctest(code[0].code, {}, group.name,
2162+ filename, code[0].lineno)
2163+ except Exception:
2164+ self.warn('ignoring invalid doctest code: %r' %
2165+ code[0].code,
2166+ '%s:%s' % (filename, code[0].lineno))
2167+ continue
2168 if not test.examples:
2169 continue
2170 for example in test.examples:
2171
2172=== modified file 'sphinx/ext/inheritance_diagram.py'
2173--- sphinx/ext/inheritance_diagram.py 2011-11-20 15:56:50 +0000
2174+++ sphinx/ext/inheritance_diagram.py 2012-03-27 21:09:18 +0000
2175@@ -39,6 +39,7 @@
2176 import re
2177 import sys
2178 import inspect
2179+import __builtin__
2180 try:
2181 from hashlib import md5
2182 except ImportError:
2183@@ -142,7 +143,7 @@
2184 displayed node names.
2185 """
2186 all_classes = {}
2187- builtins = __builtins__.values()
2188+ builtins = vars(__builtin__).values()
2189
2190 def recurse(cls):
2191 if not show_builtins and cls in builtins:
2192
2193=== modified file 'sphinx/ext/intersphinx.py'
2194--- sphinx/ext/intersphinx.py 2012-02-05 19:33:59 +0000
2195+++ sphinx/ext/intersphinx.py 2012-03-27 21:09:18 +0000
2196@@ -30,6 +30,7 @@
2197 import urllib2
2198 import posixpath
2199 from os import path
2200+import re
2201
2202 from docutils import nodes
2203
2204@@ -99,7 +100,12 @@
2205 assert not buf
2206
2207 for line in split_lines(read_chunks()):
2208- name, type, prio, location, dispname = line.rstrip().split(None, 4)
2209+ # be careful to handle names with embedded spaces correctly
2210+ m = re.match(r'(?x)(.+?)\s+(\S*:\S*)\s+(\S+)\s+(\S+)\s+(.*)',
2211+ line.rstrip())
2212+ if not m:
2213+ continue
2214+ name, type, prio, location, dispname = m.groups()
2215 if location.endswith(u'$'):
2216 location = location[:-1] + name
2217 location = join(uri, location)
2218
2219=== modified file 'sphinx/highlighting.py'
2220--- sphinx/highlighting.py 2012-02-05 19:33:59 +0000
2221+++ sphinx/highlighting.py 2012-03-27 21:09:18 +0000
2222@@ -10,7 +10,6 @@
2223 """
2224
2225 import sys
2226-import cgi
2227 import re
2228 import textwrap
2229
2230@@ -20,6 +19,7 @@
2231 # parser is not available on Jython
2232 parser = None
2233
2234+from sphinx.util.pycompat import htmlescape
2235 from sphinx.util.texescape import tex_hl_escape_map_new
2236 from sphinx.ext import doctest
2237
2238@@ -105,7 +105,7 @@
2239
2240 def unhighlighted(self, source):
2241 if self.dest == 'html':
2242- return '<pre>' + cgi.escape(source) + '</pre>\n'
2243+ return '<pre>' + htmlescape(source) + '</pre>\n'
2244 else:
2245 # first, escape highlighting characters like Pygments does
2246 source = source.translate(escape_hl_chars)
2247@@ -153,7 +153,7 @@
2248 else:
2249 return True
2250
2251- def highlight_block(self, source, lang, warn=None, **kwargs):
2252+ def highlight_block(self, source, lang, warn=None, force=False, **kwargs):
2253 if not isinstance(source, unicode):
2254 source = source.decode()
2255 if not pygments:
2256@@ -164,12 +164,14 @@
2257 if source.startswith('>>>'):
2258 # interactive session
2259 lexer = lexers['pycon']
2260- else:
2261+ elif not force:
2262 # maybe Python -- try parsing it
2263 if self.try_parse(source):
2264 lexer = lexers['python']
2265 else:
2266 return self.unhighlighted(source)
2267+ else:
2268+ lexer = lexers['python']
2269 elif lang in ('python3', 'py3') and source.startswith('>>>'):
2270 # for py3, recognize interactive sessions, but do not try parsing...
2271 lexer = lexers['pycon3']
2272
2273=== modified file 'sphinx/locale/fr/LC_MESSAGES/sphinx.mo'
2274Binary files sphinx/locale/fr/LC_MESSAGES/sphinx.mo 2012-02-05 19:33:59 +0000 and sphinx/locale/fr/LC_MESSAGES/sphinx.mo 2012-03-27 21:09:18 +0000 differ
2275=== modified file 'sphinx/locale/fr/LC_MESSAGES/sphinx.po'
2276--- sphinx/locale/fr/LC_MESSAGES/sphinx.po 2012-02-05 19:33:59 +0000
2277+++ sphinx/locale/fr/LC_MESSAGES/sphinx.po 2012-03-27 21:09:18 +0000
2278@@ -303,9 +303,8 @@
2279 msgstr "%s (module)"
2280
2281 #: sphinx/domains/python.py:491
2282-#, fuzzy
2283 msgid "Python Module Index"
2284-msgstr "Index du module"
2285+msgstr "Index des modules Python"
2286
2287 #: sphinx/domains/python.py:492
2288 msgid "modules"
2289@@ -324,7 +323,6 @@
2290 msgstr "méthode"
2291
2292 #: sphinx/domains/python.py:564
2293-#, fuzzy
2294 msgid "class method"
2295 msgstr "méthode de classe"
2296
2297@@ -437,9 +435,8 @@
2298 msgstr ""
2299
2300 #: sphinx/ext/viewcode.py:131
2301-#, fuzzy
2302 msgid "Module code"
2303-msgstr "module"
2304+msgstr "Code du module"
2305
2306 #: sphinx/ext/viewcode.py:137
2307 #, python-format
2308@@ -544,9 +541,8 @@
2309 msgstr "Go"
2310
2311 #: sphinx/themes/agogo/layout.html:57 sphinx/themes/basic/searchbox.html:20
2312-#, fuzzy
2313 msgid "Enter search terms or a module, class or function name."
2314-msgstr "Saisissez un nom de module, classe ou fonction."
2315+msgstr "Saisissez un mot clef ou un nom de module, classe ou fonction."
2316
2317 #: sphinx/themes/agogo/layout.html:78 sphinx/themes/basic/sourcelink.html:14
2318 msgid "Show Source"
2319@@ -673,7 +669,6 @@
2320 msgstr "Activez le JavaScript pour que la recherche fonctionne."
2321
2322 #: sphinx/themes/basic/search.html:29
2323-#, fuzzy
2324 msgid ""
2325 "From here you can search these documents. Enter your search\n"
2326 " words into the box below and click \"search\". Note that the search\n"
2327@@ -684,7 +679,7 @@
2328 "termes\n"
2329 " de votre recherche dans le champs ci-dessous et cliquez sur "
2330 "\"rechercher\". Notez que la fonctionnalité de recherche\n"
2331-" va automatique chercher pour tous les mots. Les pages\n"
2332+" va automatiquement chercher parmi l'ensemble les mots. Les pages\n"
2333 " contenant moins de mots n'apparaîtront pas dans la liste des "
2334 "résultats."
2335
2336@@ -776,7 +771,6 @@
2337 msgstr "Suite de la page précédente"
2338
2339 #: sphinx/writers/latex.py:681
2340-#, fuzzy
2341 msgid "Continued on next page"
2342 msgstr "Suite sur la page suivante"
2343
2344
2345=== modified file 'sphinx/pycode/pgen2/driver.py'
2346--- sphinx/pycode/pgen2/driver.py 2011-09-28 17:20:22 +0000
2347+++ sphinx/pycode/pgen2/driver.py 2012-03-27 21:09:18 +0000
2348@@ -120,7 +120,7 @@
2349 head, tail = os.path.splitext(gt)
2350 if tail == ".txt":
2351 tail = ""
2352- gp = head + tail + ".pickle"
2353+ gp = head + tail + ".".join(map(str, sys.version_info[:2])) + ".pickle"
2354 if force or not _newer(gp, gt):
2355 logger.info("Generating grammar tables from %s", gt)
2356 g = pgen.generate_grammar(gt)
2357
2358=== modified file 'sphinx/setup_command.py'
2359--- sphinx/setup_command.py 2012-02-05 19:33:59 +0000
2360+++ sphinx/setup_command.py 2012-03-27 21:09:18 +0000
2361@@ -81,6 +81,7 @@
2362 self.fresh_env = self.all_files = False
2363 self.source_dir = self.build_dir = None
2364 self.builder = 'html'
2365+ self.project = ''
2366 self.version = ''
2367 self.release = ''
2368 self.today = ''
2369@@ -125,6 +126,8 @@
2370 else:
2371 status_stream = sys.stdout
2372 confoverrides = {}
2373+ if self.project:
2374+ confoverrides['project'] = self.project
2375 if self.version:
2376 confoverrides['version'] = self.version
2377 if self.release:
2378
2379=== modified file 'sphinx/texinputs/sphinx.sty'
2380--- sphinx/texinputs/sphinx.sty 2012-02-05 19:33:59 +0000
2381+++ sphinx/texinputs/sphinx.sty 2012-03-27 21:09:18 +0000
2382@@ -402,10 +402,15 @@
2383 }
2384
2385
2386-% Fix the index and bibliography environments to add an entry to the Table of
2387+% Fix the index environment to add an entry to the Table of
2388 % Contents; this is much nicer than just having to jump to the end of the book
2389 % and flip around, especially with multiple indexes.
2390 %
2391+% A similiar fix must be done to the bibliography environment, although
2392+% dependant on document class. In particular, the '\addcontentsline' command
2393+% should use 'chapter' for a report and 'section' for an article.
2394+% See sphinxmanual.cls and sphinxhowto.cls for specific fixes.
2395+%
2396 \let\py@OldTheindex=\theindex
2397 \renewcommand{\theindex}{
2398 \cleardoublepage
2399@@ -414,14 +419,6 @@
2400 \addcontentsline{toc}{chapter}{\indexname}
2401 }
2402
2403-\let\py@OldThebibliography=\thebibliography
2404-\renewcommand{\thebibliography}[1]{
2405- \cleardoublepage
2406- \phantomsection
2407- \py@OldThebibliography{1}
2408- \addcontentsline{toc}{chapter}{\bibname}
2409-}
2410-
2411 % Include hyperref last.
2412 \RequirePackage[colorlinks,breaklinks,
2413 linkcolor=InnerLinkColor,filecolor=OuterLinkColor,
2414
2415=== modified file 'sphinx/texinputs/sphinxhowto.cls'
2416--- sphinx/texinputs/sphinxhowto.cls 2010-05-25 23:01:44 +0000
2417+++ sphinx/texinputs/sphinxhowto.cls 2012-03-27 21:09:18 +0000
2418@@ -79,3 +79,14 @@
2419 \pagenumbering{arabic} % ToC & chapters
2420
2421 \thispagestyle{empty}
2422+
2423+% Fix the bibliography environment to add an entry to the Table of
2424+% Contents.
2425+% For an article document class this environment is a section,
2426+% so no page break before it.
2427+\let\py@OldThebibliography=\thebibliography
2428+\renewcommand{\thebibliography}[1]{
2429+ \phantomsection
2430+ \py@OldThebibliography{1}
2431+ \addcontentsline{toc}{section}{\bibname}
2432+}
2433
2434=== modified file 'sphinx/texinputs/sphinxmanual.cls'
2435--- sphinx/texinputs/sphinxmanual.cls 2010-05-25 23:01:44 +0000
2436+++ sphinx/texinputs/sphinxmanual.cls 2012-03-27 21:09:18 +0000
2437@@ -120,3 +120,14 @@
2438 %
2439 \renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.6em}}
2440 \renewcommand*\l@subsection{\@dottedtocline{2}{4.1em}{3.5em}}
2441+
2442+% Fix the bibliography environment to add an entry to the Table of
2443+% Contents.
2444+% For a report document class this environment is a chapter.
2445+\let\py@OldThebibliography=\thebibliography
2446+\renewcommand{\thebibliography}[1]{
2447+ \cleardoublepage
2448+ \phantomsection
2449+ \py@OldThebibliography{1}
2450+ \addcontentsline{toc}{chapter}{\bibname}
2451+}
2452
2453=== modified file 'sphinx/themes/basic/static/basic.css_t'
2454--- sphinx/themes/basic/static/basic.css_t 2011-11-20 15:56:50 +0000
2455+++ sphinx/themes/basic/static/basic.css_t 2012-03-27 21:09:18 +0000
2456@@ -79,11 +79,11 @@
2457 font-size: 1em;
2458 }
2459
2460-div.sphinxsidebar input[type="text"] {
2461+div.sphinxsidebar #searchbox input[type="text"] {
2462 width: 170px;
2463 }
2464
2465-div.sphinxsidebar input[type="submit"] {
2466+div.sphinxsidebar #searchbox input[type="submit"] {
2467 width: 30px;
2468 }
2469
2470
2471=== modified file 'sphinx/util/__init__.py'
2472--- sphinx/util/__init__.py 2012-02-05 19:33:59 +0000
2473+++ sphinx/util/__init__.py 2012-03-27 21:09:18 +0000
2474@@ -28,6 +28,7 @@
2475
2476 import sphinx
2477 from sphinx.errors import PycodeError
2478+from sphinx.util.pycompat import bytes
2479
2480 # import other utilities; partly for backwards compatibility, so don't
2481 # prune unused ones indiscriminately
2482@@ -310,7 +311,7 @@
2483
2484 def force_decode(string, encoding):
2485 """Forcibly get a unicode string out of a bytestring."""
2486- if isinstance(string, str):
2487+ if isinstance(string, bytes):
2488 if encoding:
2489 string = string.decode(encoding)
2490 else:
2491
2492=== modified file 'sphinx/util/inspect.py'
2493--- sphinx/util/inspect.py 2011-11-20 15:56:50 +0000
2494+++ sphinx/util/inspect.py 2012-03-27 21:09:18 +0000
2495@@ -15,6 +15,9 @@
2496 # relatively import this module
2497 inspect = __import__('inspect')
2498
2499+from sphinx.util import force_decode
2500+from sphinx.util.pycompat import bytes
2501+
2502
2503 if sys.version_info >= (2, 5):
2504 from functools import partial
2505@@ -87,4 +90,6 @@
2506 s = repr(object)
2507 except Exception:
2508 raise ValueError
2509+ if isinstance(s, bytes):
2510+ return force_decode(s, None).replace('\n', ' ')
2511 return s.replace('\n', ' ')
2512
2513=== modified file 'sphinx/util/nodes.py'
2514--- sphinx/util/nodes.py 2011-11-20 15:56:50 +0000
2515+++ sphinx/util/nodes.py 2012-03-27 21:09:18 +0000
2516@@ -179,8 +179,12 @@
2517 directive.state_machine.get_source_and_line(directive.lineno)
2518
2519 def set_role_source_info(inliner, lineno, node):
2520+ try:
2521 node.source, node.line = \
2522 inliner.reporter.locator(lineno)
2523+ except AttributeError:
2524+ # docutils 0.9+
2525+ node.source, node.line = inliner.reporter.get_source_and_line(lineno)
2526
2527 # monkey-patch Node.__contains__ to get consistent "in" operator behavior
2528 # across docutils versions
2529
2530=== modified file 'sphinx/util/osutil.py'
2531--- sphinx/util/osutil.py 2011-11-20 15:56:50 +0000
2532+++ sphinx/util/osutil.py 2012-03-27 21:09:18 +0000
2533@@ -142,4 +142,9 @@
2534 return path
2535
2536 def find_catalog(docname, compaction):
2537- return docname.split(SEP, 1)[0] if compaction else docname
2538+ if compaction:
2539+ ret = docname.split(SEP, 1)[0]
2540+ else:
2541+ ret = docname
2542+
2543+ return ret
2544
2545=== modified file 'sphinx/util/pycompat.py'
2546--- sphinx/util/pycompat.py 2011-11-20 15:56:50 +0000
2547+++ sphinx/util/pycompat.py 2012-03-27 21:09:18 +0000
2548@@ -64,6 +64,11 @@
2549 return s.encode('ascii', 'backslashreplace')
2550
2551
2552+try:
2553+ from html import escape as htmlescape
2554+except ImportError:
2555+ from cgi import escape as htmlescape
2556+
2557 # ------------------------------------------------------------------------------
2558 # Missing builtins and itertools in Python < 2.6
2559
2560
2561=== modified file 'sphinx/websupport/__init__.py'
2562--- sphinx/websupport/__init__.py 2011-11-20 15:56:50 +0000
2563+++ sphinx/websupport/__init__.py 2012-03-27 21:09:18 +0000
2564@@ -9,7 +9,6 @@
2565 :license: BSD, see LICENSE for details.
2566 """
2567
2568-import cgi
2569 import sys
2570 import cPickle as pickle
2571 import posixpath
2572@@ -22,6 +21,7 @@
2573 from sphinx.application import Sphinx
2574 from sphinx.util.osutil import ensuredir
2575 from sphinx.util.jsonimpl import dumps as dump_json
2576+from sphinx.util.pycompat import htmlescape
2577 from sphinx.websupport import errors
2578 from sphinx.websupport.search import BaseSearch, SEARCH_ADAPTERS
2579 from sphinx.websupport.storage import StorageBackend
2580@@ -452,5 +452,5 @@
2581 ret = publish_parts(text, writer_name='html',
2582 settings_overrides=settings)['fragment']
2583 except Exception:
2584- ret = cgi.escape(text)
2585+ ret = htmlescape(text)
2586 return ret
2587
2588=== modified file 'sphinx/websupport/storage/differ.py'
2589--- sphinx/websupport/storage/differ.py 2011-11-20 15:56:50 +0000
2590+++ sphinx/websupport/storage/differ.py 2012-03-27 21:09:18 +0000
2591@@ -10,9 +10,10 @@
2592 """
2593
2594 import re
2595-from cgi import escape
2596 from difflib import Differ
2597
2598+from sphinx.util.pycompat import htmlescape
2599+
2600
2601 class CombinedHtmlDiff(object):
2602 """Create an HTML representation of the differences between two pieces
2603@@ -21,7 +22,7 @@
2604 highlight_regex = re.compile(r'([\+\-\^]+)')
2605
2606 def __init__(self, source, proposal):
2607- proposal = escape(proposal)
2608+ proposal = htmlescape(proposal)
2609
2610 differ = Differ()
2611 self.diff = list(differ.compare(source.splitlines(1),
2612
2613=== modified file 'sphinx/websupport/storage/sqlalchemy_db.py'
2614--- sphinx/websupport/storage/sqlalchemy_db.py 2011-11-20 15:56:50 +0000
2615+++ sphinx/websupport/storage/sqlalchemy_db.py 2012-03-27 21:09:18 +0000
2616@@ -77,7 +77,10 @@
2617 comments = []
2618 list_stack = [comments]
2619 for r in results:
2620- comment, vote = r if username else (r, 0)
2621+ if username:
2622+ comment, vote = r
2623+ else:
2624+ comment, vote = (r, 0)
2625
2626 inheritance_chain = comment.path.split('.')[1:]
2627
2628@@ -176,7 +179,10 @@
2629
2630 path = self.path.split('.')
2631 node = path[0]
2632- parent = path[-2] if len(path) > 2 else None
2633+ if len(path) > 2:
2634+ parent = path[-2]
2635+ else:
2636+ parent = None
2637
2638 return {'text': self.text,
2639 'username': self.username or 'Anonymous',
2640@@ -201,8 +207,16 @@
2641 minutes = seconds / 60
2642
2643 if days == 0:
2644- dt = (minutes, 'minute') if hours == 0 else (hours, 'hour')
2645+ if hours == 0:
2646+ dt = (minutes, 'minute')
2647+ else:
2648+ dt = (hours, 'hour')
2649 else:
2650 dt = (days, 'day')
2651
2652- return '%s %s ago' % dt if dt[0] == 1 else '%s %ss ago' % dt
2653+ if dt[0] == 1:
2654+ ret = '%s %s ago' % dt
2655+ else:
2656+ ret = '%s %ss ago' % dt
2657+
2658+ return ret
2659
2660=== modified file 'sphinx/writers/html.py'
2661--- sphinx/writers/html.py 2011-11-20 15:56:50 +0000
2662+++ sphinx/writers/html.py 2012-03-27 21:09:18 +0000
2663@@ -65,6 +65,8 @@
2664 self.permalink_text = self.permalink_text and u'\u00B6' or ''
2665 self.permalink_text = self.encode(self.permalink_text)
2666 self.secnumber_suffix = builder.config.html_secnumber_suffix
2667+ self.param_separator = ''
2668+ self._table_row_index = 0
2669
2670 def visit_start_of_file(self, node):
2671 # only occurs in the single-file builder
2672@@ -233,12 +235,13 @@
2673 lang = self.highlightlang
2674 linenos = node.rawsource.count('\n') >= \
2675 self.highlightlinenothreshold - 1
2676+ highlight_args = node.get('highlight_args', {})
2677 if node.has_key('language'):
2678 # code-block directives
2679 lang = node['language']
2680+ highlight_args['force'] = True
2681 if node.has_key('linenos'):
2682 linenos = node['linenos']
2683- highlight_args = node.get('highlight_args', {})
2684 def warner(msg):
2685 self.builder.warn(msg, (self.builder.current_docname, node.line))
2686 highlighted = self.highlighter.highlight_block(
2687@@ -355,6 +358,9 @@
2688 return
2689
2690 if node.has_key('scale'):
2691+ # Try to figure out image height and width. Docutils does that too,
2692+ # but it tries the final file name, which does not necessarily exist
2693+ # yet at the time the HTML file is written.
2694 if Image and not (node.has_key('width')
2695 and node.has_key('height')):
2696 try:
2697
2698=== modified file 'sphinx/writers/latex.py'
2699--- sphinx/writers/latex.py 2011-11-20 15:56:50 +0000
2700+++ sphinx/writers/latex.py 2012-03-27 21:09:18 +0000
2701@@ -1299,12 +1299,13 @@
2702 code = self.verbatim.rstrip('\n')
2703 lang = self.hlsettingstack[-1][0]
2704 linenos = code.count('\n') >= self.hlsettingstack[-1][1] - 1
2705+ highlight_args = node.get('highlight_args', {})
2706 if 'language' in node:
2707 # code-block directives
2708 lang = node['language']
2709+ highlight_args['force'] = True
2710 if 'linenos' in node:
2711 linenos = node['linenos']
2712- highlight_args = node.get('highlight_args', {})
2713 def warner(msg):
2714 self.builder.warn(msg, (self.curfilestack[-1], node.line))
2715 hlcode = self.highlighter.highlight_block(code, lang, warn=warner,
2716
2717=== modified file 'tests/run.py'
2718--- tests/run.py 2011-11-20 15:56:50 +0000
2719+++ tests/run.py 2012-03-27 21:09:18 +0000
2720@@ -22,9 +22,11 @@
2721 copydir_run_2to3(testroot, newroot)
2722 # switch to the converted dir so nose tests the right tests
2723 chdir(newroot)
2724-
2725-# always test the sphinx package from this directory
2726-sys.path.insert(0, path.join(path.dirname(__file__), path.pardir))
2727+ # always test the sphinx package from build/lib/
2728+ sys.path.insert(0, path.pardir)
2729+else:
2730+ # always test the sphinx package from this directory
2731+ sys.path.insert(0, path.join(path.dirname(__file__), path.pardir))
2732
2733 try:
2734 import nose
2735
2736=== modified file 'tests/test_build_html.py'
2737--- tests/test_build_html.py 2011-11-20 15:56:50 +0000
2738+++ tests/test_build_html.py 2012-03-27 21:09:18 +0000
2739@@ -258,7 +258,7 @@
2740 r'def'),
2741 (".//div[@class='inc-tab3 highlight-text']//pre",
2742 r'-| |-'),
2743- (".//div[@class='inc-tab8 highlight-python']//pre",
2744+ (".//div[@class='inc-tab8 highlight-python']//pre/span",
2745 r'-| |-'),
2746 ])
2747 HTML_XPATH['subdir/includes.html'].extend([
2748@@ -328,7 +328,11 @@
2749 for fname, paths in HTML_XPATH.iteritems():
2750 parser = NslessParser()
2751 parser.entity.update(htmlentitydefs.entitydefs)
2752- etree = ET.parse(os.path.join(app.outdir, fname), parser)
2753+ fp = open(os.path.join(app.outdir, fname))
2754+ try:
2755+ etree = ET.parse(fp, parser)
2756+ finally:
2757+ fp.close()
2758 for path, check in paths:
2759 yield check_xpath, etree, fname, path, check
2760
2761
2762=== modified file 'tests/test_intersphinx.py'
2763--- tests/test_intersphinx.py 2011-11-20 15:56:50 +0000
2764+++ tests/test_intersphinx.py 2012-03-27 21:09:18 +0000
2765@@ -43,6 +43,7 @@
2766 module2 py:module 0 foo.html#module-$ -
2767 module1.func py:function 1 sub/foo.html#$ -
2768 CFunc c:function 2 cfunc.html#CFunc -
2769+a term std:term -1 glossary.html#term-a-term -
2770 '''.encode('utf-8'))
2771
2772
2773@@ -76,6 +77,8 @@
2774 assert invdata1['py:function']['module1.func'][2] == \
2775 '/util/sub/foo.html#module1.func'
2776 assert invdata1['c:function']['CFunc'][2] == '/util/cfunc.html#CFunc'
2777+ assert invdata1['std:term']['a term'][2] == \
2778+ '/util/glossary.html#term-a-term'
2779
2780
2781 @with_app(confoverrides={'extensions': 'sphinx.ext.intersphinx'})
2782
2783=== modified file 'tests/test_quickstart.py'
2784--- tests/test_quickstart.py 2012-02-05 19:33:59 +0000
2785+++ tests/test_quickstart.py 2012-03-27 21:09:18 +0000
2786@@ -91,7 +91,7 @@
2787 conffile = tempdir / 'conf.py'
2788 assert conffile.isfile()
2789 ns = {}
2790- f = open(conffile, 'U')
2791+ f = open(conffile, 'rbU')
2792 try:
2793 code = compile(f.read(), conffile, 'exec')
2794 finally:
2795@@ -151,7 +151,7 @@
2796 conffile = tempdir / 'source' / 'conf.py'
2797 assert conffile.isfile()
2798 ns = {}
2799- f = open(conffile, 'U')
2800+ f = open(conffile, 'rbU')
2801 try:
2802 code = compile(f.read(), conffile, 'exec')
2803 finally:

Subscribers

People subscribed via source and target branches