diff --git a/.travis.yml b/.travis.yml index 45bf4bb40..f4b5abb5c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ python: - "pypy" env: global: - - TEST=-v + - TEST='-v --with-timer --timer-top-n 25' matrix: - DOCUTILS=0.11 - DOCUTILS=0.12 diff --git a/CHANGES b/CHANGES index a1d01ae67..148ba7767 100644 --- a/CHANGES +++ b/CHANGES @@ -84,6 +84,8 @@ Release 1.4.6 (in development) Bugs fixed ---------- +* applehelp: Sphinx crashes if ``hiutil`` or ``codesign`` commands not found + Release 1.4.5 (released Jul 13, 2016) ===================================== diff --git a/sphinx/builders/applehelp.py b/sphinx/builders/applehelp.py index e8a476f60..7db086953 100644 --- a/sphinx/builders/applehelp.py +++ b/sphinx/builders/applehelp.py @@ -214,16 +214,19 @@ class AppleHelpBuilder(StandaloneHTMLBuilder): self.warn('you will need to index this help book with:\n %s' % (' '.join([pipes.quote(arg) for arg in args]))) else: - p = subprocess.Popen(args, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT) + try: + p = subprocess.Popen(args, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) - output = p.communicate()[0] + output = p.communicate()[0] - if p.returncode != 0: - raise AppleHelpIndexerFailed(output) - else: - self.info('done') + if p.returncode != 0: + raise AppleHelpIndexerFailed(output) + else: + self.info('done') + except OSError: + raise AppleHelpIndexerFailed('Command not found: %s' % args[0]) # If we've been asked to, sign the bundle if self.config.applehelp_codesign_identity: @@ -245,16 +248,19 @@ class AppleHelpBuilder(StandaloneHTMLBuilder): self.warn('you will need to sign this help book with:\n %s' % (' '.join([pipes.quote(arg) for arg in args]))) else: - p = subprocess.Popen(args, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT) + try: + p = subprocess.Popen(args, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) - output = p.communicate()[0] + output = p.communicate()[0] - if p.returncode != 0: - raise AppleHelpCodeSigningFailed(output) - else: - self.info('done') + if p.returncode != 0: + raise AppleHelpCodeSigningFailed(output) + else: + self.info('done') + except OSError: + raise AppleHelpCodeSigningFailed('Command not found: %s' % args[0]) def setup(app): diff --git a/test-reqs.txt b/test-reqs.txt index 690174b7d..e0eb41ebd 100644 --- a/test-reqs.txt +++ b/test-reqs.txt @@ -1,5 +1,6 @@ flake8 nose +nose-timer mock six>=1.4 Jinja2>=2.3 diff --git a/tests/root/footnote.txt b/tests/root/footnote.txt index 36ad3fadc..a040f10f3 100644 --- a/tests/root/footnote.txt +++ b/tests/root/footnote.txt @@ -53,9 +53,3 @@ footenotes .. [#] footnotes in table caption .. [#] footnotes in table - - -missing target --------------------- -[missing]_ citation - diff --git a/tests/root/images.txt b/tests/root/images.txt index e78f8be3c..3dd8e6957 100644 --- a/tests/root/images.txt +++ b/tests/root/images.txt @@ -15,9 +15,6 @@ Sphinx image handling .. an image with unspecified extension .. image:: img.* -.. a non-existing image with .* -.. image:: foo.* - .. a non-local image URI .. image:: http://www.python.org/logo.png diff --git a/tests/root/includes.txt b/tests/root/includes.txt index 41b72b0ab..e921a966c 100644 --- a/tests/root/includes.txt +++ b/tests/root/includes.txt @@ -15,10 +15,6 @@ Test file and literal inclusion .. literalinclude:: literal.inc :language: python -.. should give a warning -.. literalinclude:: wrongenc.inc - :language: none - .. should succeed .. literalinclude:: wrongenc.inc :encoding: latin-1 diff --git a/tests/root/markup.txt b/tests/root/markup.txt index 77f245a6f..714dabe8d 100644 --- a/tests/root/markup.txt +++ b/tests/root/markup.txt @@ -161,7 +161,6 @@ Adding \n to test unescaping. * :doc:`subdir/includes` * ``:download:`` is tested in includes.txt * :option:`Python -c option ` -* This used to crash: :option:`&option` Test :abbr:`abbr (abbreviation)` and another :abbr:`abbr (abbreviation)`. @@ -295,13 +294,6 @@ Code blocks false end -.. code-block:: c - - import sys - - sys.stdout.write('hello world!\n') - - Misc stuff ---------- @@ -381,13 +373,6 @@ Index markup see: from; to seealso: fromalso; toalso -Invalid index markup... - -.. index:: - single: - pair: - keyword: - .. index:: !Main, !Other !single: entry; pair diff --git a/tests/roots/test-basic/conf.py b/tests/roots/test-basic/conf.py new file mode 100644 index 000000000..31e7a6ed4 --- /dev/null +++ b/tests/roots/test-basic/conf.py @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- + +master_doc = 'index' + +latex_documents = [ + (master_doc, 'test.tex', 'The basic Sphinx documentation for testing', 'Sphinx', 'report') +] diff --git a/tests/roots/test-basic/index.rst b/tests/roots/test-basic/index.rst new file mode 100644 index 000000000..8c4ca7d80 --- /dev/null +++ b/tests/roots/test-basic/index.rst @@ -0,0 +1,29 @@ +The basic Sphinx documentation for testing +========================================== + +Sphinx is a tool that makes it easy to create intelligent and beautiful +documentation for Python projects (or other documents consisting of multiple +reStructuredText sources), written by Georg Brandl. It was originally created +for the new Python documentation, and has excellent facilities for Python +project documentation, but C/C++ is supported as well, and more languages are +planned. + +Sphinx uses reStructuredText as its markup language, and many of its strengths +come from the power and straightforwardness of reStructuredText and its parsing +and translating suite, the Docutils. + +Among its features are the following: + +* Output formats: HTML (including derivative formats such as HTML Help, Epub + and Qt Help), plain text, manual pages and LaTeX or direct PDF output + using rst2pdf +* Extensive cross-references: semantic markup and automatic links + for functions, classes, glossary terms and similar pieces of information +* Hierarchical structure: easy definition of a document tree, with automatic + links to siblings, parents and children +* Automatic indices: general index as well as a module index +* Code handling: automatic highlighting using the Pygments highlighter +* Flexible HTML output using the Jinja 2 templating engine +* Various extensions are available, e.g. for automatic testing of snippets + and inclusion of appropriately formatted docstrings +* Setuptools integration diff --git a/tests/roots/test-ext-math-simple/conf.py b/tests/roots/test-ext-math-simple/conf.py new file mode 100644 index 000000000..3fe886c17 --- /dev/null +++ b/tests/roots/test-ext-math-simple/conf.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- + +master_doc = 'index' + +latex_documents = [ + (master_doc, 'test.tex', 'Math Extension Testing', 'Sphinx', 'report')] diff --git a/tests/roots/test-ext-math-simple/index.rst b/tests/roots/test-ext-math-simple/index.rst new file mode 100644 index 000000000..a455d8980 --- /dev/null +++ b/tests/roots/test-ext-math-simple/index.rst @@ -0,0 +1,4 @@ +Test Math +========= + +.. math:: a^2+b^2=c^2 diff --git a/tests/roots/test-ext-math/math.rst b/tests/roots/test-ext-math/math.rst new file mode 100644 index 000000000..5a209bed4 --- /dev/null +++ b/tests/roots/test-ext-math/math.rst @@ -0,0 +1,31 @@ +Test math extensions :math:`E = m c^2` +====================================== + +This is inline math: :math:`a^2 + b^2 = c^2`. + +.. math:: a^2 + b^2 = c^2 + +.. math:: + + a + 1 < b + +.. math:: + :label: foo + + e^{i\pi} = 1 + +.. math:: + :label: + + e^{ix} = \cos x + i\sin x + +.. math:: + + n \in \mathbb N + +.. math:: + :nowrap: + + a + 1 < b + +Referencing equation :eq:`foo`. diff --git a/tests/roots/test-searchadapters/conf.py b/tests/roots/test-searchadapters/conf.py new file mode 100644 index 000000000..ade976ab5 --- /dev/null +++ b/tests/roots/test-searchadapters/conf.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- + +master_doc = 'markup' +source_suffix = '.txt' diff --git a/tests/roots/test-searchadapters/markup.txt b/tests/roots/test-searchadapters/markup.txt new file mode 100644 index 000000000..77f245a6f --- /dev/null +++ b/tests/roots/test-searchadapters/markup.txt @@ -0,0 +1,447 @@ +:tocdepth: 2 + +.. title:: set by title directive + +Testing various markup +====================== + +Meta markup +----------- + +.. sectionauthor:: Georg Brandl +.. moduleauthor:: Georg Brandl + +.. contents:: TOC + +.. meta:: + :author: Me + :keywords: docs, sphinx + + +Generic reST +------------ + +A |subst| (the definition is in rst_epilog). + +.. highlight:: none + +.. _label: + +:: + + some code + +Option list: + +-h help +--help also help + +Line block: + +| line1 +| line2 +| line3 +| line4 +| line5 +| line6 +| line7 + + +Body directives +^^^^^^^^^^^^^^^ + +.. topic:: Title + + Topic body. + +.. sidebar:: Sidebar + :subtitle: Sidebar subtitle + + Sidebar body. + +.. rubric:: Test rubric + +.. epigraph:: Epigraph title + + Epigraph body. + + -- Author + +.. highlights:: Highlights + + Highlights body. + +.. pull-quote:: Pull-quote + + Pull quote body. + +.. compound:: + + a + + b + +.. parsed-literal:: + + with some *markup* inside + + +.. _admonition-section: + +Admonitions +^^^^^^^^^^^ + +.. admonition:: My Admonition + + Admonition text. + +.. note:: + Note text. + +.. warning:: + + Warning text. + +.. _some-label: + +.. tip:: + Tip text. + +Indirect hyperlink targets + +.. _other-label: some-label_ + +Inline markup +------------- + +*Generic inline markup* + +Adding \n to test unescaping. + +* :command:`command\\n` +* :dfn:`dfn\\n` +* :guilabel:`guilabel with &accelerator and \\n` +* :kbd:`kbd\\n` +* :mailheader:`mailheader\\n` +* :makevar:`makevar\\n` +* :manpage:`manpage\\n` +* :mimetype:`mimetype\\n` +* :newsgroup:`newsgroup\\n` +* :program:`program\\n` +* :regexp:`regexp\\n` +* :menuselection:`File --> Close\\n` +* :menuselection:`&File --> &Print` +* :file:`a/{varpart}/b\\n` +* :samp:`print {i}\\n` + +*Linking inline markup* + +* :pep:`8` +* :pep:`Python Enhancement Proposal #8 <8>` +* :rfc:`1` +* :rfc:`Request for Comments #1 <1>` +* :envvar:`HOME` +* :keyword:`with` +* :token:`try statement ` +* :ref:`admonition-section` +* :ref:`here ` +* :ref:`there ` +* :ref:`my-figure` +* :ref:`my-figure-name` +* :ref:`my-table` +* :ref:`my-table-name` +* :ref:`my-code-block` +* :ref:`my-code-block-name` +* :numref:`my-figure` +* :numref:`my-figure-name` +* :numref:`my-table` +* :numref:`my-table-name` +* :numref:`my-code-block` +* :numref:`my-code-block-name` +* :doc:`subdir/includes` +* ``:download:`` is tested in includes.txt +* :option:`Python -c option ` +* This used to crash: :option:`&option` + +Test :abbr:`abbr (abbreviation)` and another :abbr:`abbr (abbreviation)`. + +Testing the :index:`index` role, also available with +:index:`explicit ` title. + +.. _with: + +With +---- + +(Empty section.) + + +Tables +------ + +.. tabularcolumns:: |L|p{5cm}|R| + +.. _my-table: + +.. table:: my table + :name: my-table-name + + +----+----------------+----+ + | 1 | * Block elems | x | + | | * In table | | + +----+----------------+----+ + | 2 | Empty cells: | | + +----+----------------+----+ + +.. table:: empty cell in table header + + ===== ====== + \ + ===== ====== + 1 2 + 3 4 + ===== ====== + +Tables with multirow and multicol: + +.. only:: latex + + +----+----------------+---------+ + | 1 | test! | c | + +----+---------+------+ | + | 2 | col | col | | + | y +---------+------+----+----+ + | x | multi-column cell | x | + +----+---------------------+----+ + + +----+ + | 1 | + + + + | | + +----+ + +.. list-table:: + :header-rows: 0 + + * - .. figure:: img.png + + figure in table + + +Figures +------- + +.. _my-figure: + +.. figure:: img.png + :name: my-figure-name + + My caption of the figure + + My description paragraph of the figure. + + Description paragraph is wraped with legend node. + +.. figure:: rimg.png + :align: right + + figure with align option + +.. figure:: rimg.png + :align: right + :figwidth: 50% + + figure with align & figwidth option + +.. figure:: rimg.png + :align: right + :width: 3cm + + figure with align & width option + +Version markup +-------------- + +.. versionadded:: 0.6 + Some funny **stuff**. + +.. versionchanged:: 0.6 + Even more funny stuff. + +.. deprecated:: 0.6 + Boring stuff. + +.. versionadded:: 1.2 + + First paragraph of versionadded. + +.. versionchanged:: 1.2 + First paragraph of versionchanged. + + Second paragraph of versionchanged. + + +Code blocks +----------- + +.. _my-code-block: + +.. code-block:: ruby + :linenos: + :caption: my ruby code + :name: my-code-block-name + + def ruby? + false + end + +.. code-block:: c + + import sys + + sys.stdout.write('hello world!\n') + + +Misc stuff +---------- + +Stuff [#]_ + +Reference lookup: [Ref1]_ (defined in another file). +Reference lookup underscore: [Ref_1]_ + +.. seealso:: something, something else, something more + + `Google `_ + For everything. + +.. hlist:: + :columns: 4 + + * This + * is + * a horizontal + * list + * with several + * items + +.. rubric:: Side note + +This is a side note. + +This tests :CLASS:`role names in uppercase`. + +.. centered:: LICENSE AGREEMENT + +.. acks:: + + * Terry Pratchett + * J. R. R. Tolkien + * Monty Python + +.. glossary:: + :sorted: + + boson + Particle with integer spin. + + *fermion* + Particle with half-integer spin. + + tauon + myon + electron + Examples for fermions. + + über + Gewisse + + änhlich + Dinge + +.. productionlist:: + try_stmt: `try1_stmt` | `try2_stmt` + try1_stmt: "try" ":" `suite` + : ("except" [`expression` ["," `target`]] ":" `suite`)+ + : ["else" ":" `suite`] + : ["finally" ":" `suite`] + try2_stmt: "try" ":" `suite` + : "finally" ":" `suite` + + +Index markup +------------ + +.. index:: + single: entry + pair: entry; pair + double: entry; double + triple: index; entry; triple + keyword: with + see: from; to + seealso: fromalso; toalso + +Invalid index markup... + +.. index:: + single: + pair: + keyword: + +.. index:: + !Main, !Other + !single: entry; pair + +:index:`!Main` + +.. _ölabel: + +Ö... Some strange characters +---------------------------- + +Testing öäü... + + +Only directive +-------------- + +.. only:: html + + In HTML. + +.. only:: latex + + In LaTeX. + +.. only:: html or latex + + In both. + +.. only:: confpytag and (testtag or nonexisting_tag) + + Always present, because set through conf.py/command line. + + +Any role +-------- + +.. default-role:: any + +Test referencing to `headings ` and `objects `. +Also `modules ` and `classes