commit python-sphinxcontrib-programoutput for openSUSE:Factory
Hello community, here is the log from the commit of package python-sphinxcontrib-programoutput for openSUSE:Factory checked in at 2019-04-30 12:59:49 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-sphinxcontrib-programoutput (Old) and /work/SRC/openSUSE:Factory/.python-sphinxcontrib-programoutput.new.5536 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-sphinxcontrib-programoutput" Tue Apr 30 12:59:49 2019 rev:5 rq:697385 version:0.14 Changes: -------- --- /work/SRC/openSUSE:Factory/python-sphinxcontrib-programoutput/python-sphinxcontrib-programoutput.changes 2018-12-24 11:44:37.737279957 +0100 +++ /work/SRC/openSUSE:Factory/.python-sphinxcontrib-programoutput.new.5536/python-sphinxcontrib-programoutput.changes 2019-04-30 12:59:54.666178964 +0200 @@ -1,0 +2,15 @@ +Tue Apr 23 11:54:16 UTC 2019 - Marketa Calabkova <mcalabkova@suse.com> + +- update to version 0.14 + * Add python_requires metadata to better allow tools like pip to + install a correct version. + * Add support for Sphinx 2.0 on Python 3. + * Avoid unicode errors when the program command or output produced + non-ASCII output and the configured prompt was a byte string. + * Drop support for Sphinx < 1.7. + * Fix tests on Sphinx >= 1.8.0. + * Fix deprecation warnings on Sphinx >= 1.8. + * Explicitly set parallel_read_safe to true in the extension + metadata. + +------------------------------------------------------------------- Old: ---- sphinxcontrib-programoutput-0.10.tar.gz New: ---- sphinxcontrib-programoutput-0.14.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-sphinxcontrib-programoutput.spec ++++++ --- /var/tmp/diff_new_pack.1ApOJK/_old 2019-04-30 12:59:56.374178583 +0200 +++ /var/tmp/diff_new_pack.1ApOJK/_new 2019-04-30 12:59:56.374178583 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-sphinxcontrib-programoutput # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,20 +17,20 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} -%bcond_with test +%bcond_without test Name: python-sphinxcontrib-programoutput -Version: 0.10 +Version: 0.14 Release: 0 Summary: Sphinx extension to include program output License: BSD-2-Clause Group: Development/Languages/Python URL: http://sphinxcontrib-programoutput.readthedocs.org/ Source: https://files.pythonhosted.org/packages/source/s/sphinxcontrib-programoutput/sphinxcontrib-programoutput-%{version}.tar.gz -BuildRequires: %{python_module Sphinx} +BuildRequires: %{python_module Sphinx >= 1.8} BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros -Requires: python-Sphinx +Requires: python-Sphinx >= 1.8 BuildArch: noarch %if %{with test} BuildRequires: %{python_module pytest} @@ -54,9 +54,7 @@ %if %{with test} %check export LANG=en_US.UTF-8 -%{python_expand export PYTHONPATH=%{buildroot}%{$python_sitelib} -py.test-%{$python_bin_suffix} -} +%python_exec setup.py test %endif %files %{python_files} ++++++ sphinxcontrib-programoutput-0.10.tar.gz -> sphinxcontrib-programoutput-0.14.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxcontrib-programoutput-0.10/.travis.yml new/sphinxcontrib-programoutput-0.14/.travis.yml --- old/sphinxcontrib-programoutput-0.10/.travis.yml 2017-03-17 16:39:01.000000000 +0100 +++ new/sphinxcontrib-programoutput-0.14/.travis.yml 2019-04-08 20:00:33.000000000 +0200 @@ -1,24 +1,33 @@ +group: travis_latest language: python -sudo: false git: depth: 1 python: - - pypy-5.4.1 - 2.7 - 3.5 -# Pylint is not supported on 3.6 yet. See -# https://github.com/PyCQA/pylint/issues/1113 et al. -env: - matrix: - - ENV=latest - - ENV=oldest + - 3.6 + - pypy + - pypy3 +# As of Apr 2019, we can't use Python 3.7 at the top-level +# without using 'dist: xenial' at the top level. But that +# breaks PyPy and PyPy3 (they can't be installed) matrix: -# Only run the oldest environment once - exclude: - - python: 3.6 - env: ENV=oldest - - python: pypy-5.4.1 - env: ENV=oldest + include: + - python: "3.7" + dist: xenial + +env: + global: + - PYTHONWARNINGS="ignore:'U' mode is deprecated:DeprecationWarning::" + +before_install: + - python --version + +install: + - pip install -U pip setuptools + - pip install -U coverage coveralls pylint + - pip install -U -e .[test] + script: - pylint -r no src/sphinxcontrib - coverage run setup.py test @@ -27,14 +36,6 @@ notifications: email: false -before_install: - - python --version - -install: - - pip install -U pip setuptools - - pip install -U coverage coveralls pylint - - if [[ $ENV == latest ]]; then pip install -U -e .[test]; fi - - if [[ $ENV == oldest ]]; then pip install Sphinx==1.3.5 && pip install -e .[test]; fi cache: pip diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxcontrib-programoutput-0.10/CHANGES.rst new/sphinxcontrib-programoutput-0.14/CHANGES.rst --- old/sphinxcontrib-programoutput-0.10/CHANGES.rst 2017-03-17 16:39:01.000000000 +0100 +++ new/sphinxcontrib-programoutput-0.14/CHANGES.rst 2019-04-08 20:00:33.000000000 +0200 @@ -1,3 +1,45 @@ +========= + Changes +========= + +0.14 (2019-04-08) +================= + +- Add ``python_requires`` metadata to better allow tools like ``pip`` + to install a correct version. + +- Add support for Sphinx 2.0 on Python 3. + +- Avoid unicode errors when the program command or output produced + non-ASCII output and the configured prompt was a byte string. This + was most likely under Python 2, where the default configured prompt + is a byte string. Reported by, and patch inspired by, `issue 33 + <https://github.com/NextThought/sphinxcontrib-programoutput/issues/33>`_ + by latricewilgus. + +0.13 (2018-12-22) +================= + +- Drop support for Sphinx < 1.7. + +- Fix tests on Sphinx >= 1.8.0. + +- Restore error message into the document by default from failed + program runs on Sphinx >= 1.8.0b1. + +- Fix deprecation warnings on Sphinx >= 1.8. Reported in `issue 29 + <https://github.com/NextThought/sphinxcontrib-programoutput/issues/29>`_ + by miili. + + +0.11 (2017-05-18) +================= + +- Explicitly set ``parallel_read_safe`` to true in the extension + metadata. See `issue 25 + <https://github.com/NextThought/sphinxcontrib-programoutput/issues/25>`_. + With thanks to Adam J. Stewart and Stephen McDowell. + 0.10 (2017-03-17) ================= @@ -16,7 +58,9 @@ - Run the tests on Travis CI. Formatting and style is enforced by pylint. - The oldest supported and tested Sphinx version is now 1.3.5. See - :issue:`17`. + `issue 17 + <https://github.com/NextThought/sphinxcontrib-programoutput/issues/17>`_. + - Remove support for Python 2.6, Python 3.2 and 3.3. @@ -34,7 +78,7 @@ 0.7 (Apr 17, 2012) ================== -- Added ``cwd`` option to :rst:dir:`program-output` +- Added ``cwd`` option to ``..program-output`` - Working directory of executed programs defaults to documentation root now @@ -48,16 +92,16 @@ 0.5 (Sep 19, 2011) ================== -- :confval:`programoutput_prompt_template` is interpreted as format string now! +- ``programoutput_prompt_template`` is interpreted as format string now! - Require Python 2.6 now -- Added ``returncode`` option to :rst:dir:`program-output` (thanks to Jan-Marek - Glogowski) +- Added ``returncode`` option to ``program-output`` (thanks to + Jan-Marek Glogowski) - Support ``returncode`` formatting key in - :confval:`programoutput_prompt_template` + ``programoutput_prompt_template`` - Warn on unexpected return codes instead of raising - :py:exc:`~subprocess.CalledProcessError` -- Turn fatal errors during command into document error messages instead of - crashing the build + ``subprocess.CalledProcessError`` +- Turn fatal errors during command into document error messages + instead of crashing the build 0.4.1 (Mar 11, 2011) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxcontrib-programoutput-0.10/PKG-INFO new/sphinxcontrib-programoutput-0.14/PKG-INFO --- old/sphinxcontrib-programoutput-0.10/PKG-INFO 2017-03-17 16:39:02.000000000 +0100 +++ new/sphinxcontrib-programoutput-0.14/PKG-INFO 2019-04-08 20:00:34.000000000 +0200 @@ -1,12 +1,13 @@ -Metadata-Version: 1.1 +Metadata-Version: 2.1 Name: sphinxcontrib-programoutput -Version: 0.10 +Version: 0.14 Summary: Sphinx extension to include program output Home-page: https://sphinxcontrib-programoutput.readthedocs.org/ -Author: Jason Madden -Author-email: jason@nextthought.com +Author: Sebastian Wiesner +Author-email: lunaryorn@gmail.com +Maintainer: Jason Madden +Maintainer-email: jason@nextthought.com License: BSD -Download-URL: https://pypi.python.org/pypi/sphinxcontrib-programoutput Description: ============================= sphinxcontrib-programoutput ============================= @@ -18,8 +19,7 @@ :target: https://coveralls.io/github/NextThought/sphinxcontrib-programoutput - - http://sphinxcontrib-programoutput.readthedocs.org + https://sphinxcontrib-programoutput.readthedocs.org A Sphinx_ extension to literally insert the output of arbitrary commands into documents, helping you to keep your command examples up to date. @@ -32,7 +32,7 @@ pip install sphinxcontrib-programoutput - The extension requires Sphinx 1.3.5 and Python 2.7 or Python 3 (Python + The extension requires Sphinx 1.7.0 and Python 2.7 or Python 3 (Python 3.5+ is tested) at least. Usage @@ -76,6 +76,126 @@ .. _PyPI: http://pypi.python.org/pypi/sphinxcontrib-programoutput .. _documentation: http://sphinxcontrib-programoutput.readthedocs.org + + ========= + Changes + ========= + + 0.14 (2019-04-08) + ================= + + - Add ``python_requires`` metadata to better allow tools like ``pip`` + to install a correct version. + + - Add support for Sphinx 2.0 on Python 3. + + - Avoid unicode errors when the program command or output produced + non-ASCII output and the configured prompt was a byte string. This + was most likely under Python 2, where the default configured prompt + is a byte string. Reported by, and patch inspired by, `issue 33 + <https://github.com/NextThought/sphinxcontrib-programoutput/issues/33>`_ + by latricewilgus. + + 0.13 (2018-12-22) + ================= + + - Drop support for Sphinx < 1.7. + + - Fix tests on Sphinx >= 1.8.0. + + - Restore error message into the document by default from failed + program runs on Sphinx >= 1.8.0b1. + + - Fix deprecation warnings on Sphinx >= 1.8. Reported in `issue 29 + <https://github.com/NextThought/sphinxcontrib-programoutput/issues/29>`_ + by miili. + + + 0.11 (2017-05-18) + ================= + + - Explicitly set ``parallel_read_safe`` to true in the extension + metadata. See `issue 25 + <https://github.com/NextThought/sphinxcontrib-programoutput/issues/25>`_. + With thanks to Adam J. Stewart and Stephen McDowell. + + 0.10 (2017-03-17) + ================= + + - Decode output from the program tolerantly, using the 'replace' + handler. Based on a `pull request + <https://github.com/habnabit/sphinxcontrib-programoutput/commit/592078e0386c2a36d50a6528b6e49d91707138bf>`_ + by Stefan C. Müller. + + + 0.9 (2017-03-15) + ================ + + - Forked and revived the project in `Gitub + <https://github.com/NextThought/sphinxcontrib-programoutput>`_. + + - Run the tests on Travis CI. Formatting and style is enforced by pylint. + + - The oldest supported and tested Sphinx version is now 1.3.5. See + `issue 17 + <https://github.com/NextThought/sphinxcontrib-programoutput/issues/17>`_. + + + - Remove support for Python 2.6, Python 3.2 and 3.3. + + - 100% test coverage. + + - Remove support for ``programoutput_use_ansi``. The + ``sphinxcontrib.ansi`` extension is no longer available on PyPI. + + 0.8 (Oct 12, 2012) + ================== + + - Migrated to GitHub + + + 0.7 (Apr 17, 2012) + ================== + + - Added ``cwd`` option to ``..program-output`` + - Working directory of executed programs defaults to documentation root now + + + 0.6 (Jan 07, 2012) + ================== + + - Python 3 support + - Require Sphinx 1.1 now + + + 0.5 (Sep 19, 2011) + ================== + + - ``programoutput_prompt_template`` is interpreted as format string now! + - Require Python 2.6 now + - Added ``returncode`` option to ``program-output`` (thanks to + Jan-Marek Glogowski) + - Support ``returncode`` formatting key in + ``programoutput_prompt_template`` + - Warn on unexpected return codes instead of raising + ``subprocess.CalledProcessError`` + - Turn fatal errors during command into document error messages + instead of crashing the build + + + 0.4.1 (Mar 11, 2011) + ==================== + + - Some source code cleanups + - Fixed installation instructions in documentation + + + 0.4 (May 21, 2010) + ================== + + - Initial release + +Keywords: sphinx cli command output program example Platform: any Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers @@ -87,7 +207,12 @@ Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Topic :: Documentation Classifier: Topic :: Utilities +Classifier: Framework :: Sphinx +Classifier: Framework :: Sphinx :: Extension +Requires-Python: >=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.* +Provides-Extra: test diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxcontrib-programoutput-0.10/README.rst new/sphinxcontrib-programoutput-0.14/README.rst --- old/sphinxcontrib-programoutput-0.10/README.rst 2017-03-17 16:39:01.000000000 +0100 +++ new/sphinxcontrib-programoutput-0.14/README.rst 2019-04-08 20:00:33.000000000 +0200 @@ -9,8 +9,7 @@ :target: https://coveralls.io/github/NextThought/sphinxcontrib-programoutput - -http://sphinxcontrib-programoutput.readthedocs.org +https://sphinxcontrib-programoutput.readthedocs.org A Sphinx_ extension to literally insert the output of arbitrary commands into documents, helping you to keep your command examples up to date. @@ -23,7 +22,7 @@ pip install sphinxcontrib-programoutput -The extension requires Sphinx 1.3.5 and Python 2.7 or Python 3 (Python +The extension requires Sphinx 1.7.0 and Python 2.7 or Python 3 (Python 3.5+ is tested) at least. Usage diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxcontrib-programoutput-0.10/doc/index.rst new/sphinxcontrib-programoutput-0.14/doc/index.rst --- old/sphinxcontrib-programoutput-0.10/doc/index.rst 2017-03-17 16:39:01.000000000 +0100 +++ new/sphinxcontrib-programoutput-0.14/doc/index.rst 2019-04-08 20:00:33.000000000 +0200 @@ -194,7 +194,7 @@ If the ``prompt`` option is given, the ``command`` itself is included in the document, so that the output mimics input in a shell prompt. - :confval:`programoutput_prompt_template` controlls the appearance of this. + :confval:`programoutput_prompt_template` controls the appearance of this. The value of the ``extraargs`` option is appended at the end of ``command`` (separated by a whitespace) before executing the command, but not included in the output of the ``prompt`` option. Use this to pass extra arguments @@ -269,7 +269,7 @@ - Squash commits on the topic branch before opening a pull request. - Respect :pep:`8` (use `pep8`_ to check your coding style compliance) - Add unit tests. -- Open a `pull request <https://help.github.com/articles/using-pull-requests>`_ +- Open a `new pull request <https://help.github.com/articles/using-pull-requests>`_ that relates to but one subject with a clear title and description in grammatically correct, complete sentences. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxcontrib-programoutput-0.10/setup.py new/sphinxcontrib-programoutput-0.14/setup.py --- old/sphinxcontrib-programoutput-0.10/setup.py 2017-03-17 16:39:01.000000000 +0100 +++ new/sphinxcontrib-programoutput-0.14/setup.py 2019-04-08 20:00:33.000000000 +0200 @@ -29,7 +29,11 @@ def read_desc(): with open('README.rst') as stream: - return stream.read() + readme = stream.read() + with open('CHANGES.rst') as stream: + changes = stream.read() + + return readme + '\n\n' + changes def read_version_number(): VERSION_PATTERN = re.compile(r"__version__ = '([^']+)'") @@ -48,7 +52,6 @@ name='sphinxcontrib-programoutput', version=read_version_number(), url='https://sphinxcontrib-programoutput.readthedocs.org/', - download_url='https://pypi.python.org/pypi/sphinxcontrib-programoutput', license='BSD', author='Sebastian Wiesner', author_email='lunaryorn@gmail.com', @@ -56,6 +59,7 @@ maintainer_email='jason@nextthought.com', description='Sphinx extension to include program output', long_description=read_desc(), + keywords="sphinx cli command output program example", zip_safe=False, classifiers=[ 'Development Status :: 5 - Production/Stable', @@ -68,10 +72,13 @@ "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", 'Topic :: Documentation', 'Topic :: Utilities', + 'Framework :: Sphinx', + 'Framework :: Sphinx :: Extension', ], platforms='any', packages=find_packages('src'), @@ -79,11 +86,12 @@ namespace_packages=['sphinxcontrib'], include_package_data=True, install_requires=[ - 'Sphinx>=1.3.5', + 'Sphinx>=1.7.0', ], tests_require=tests_require, extras_require={ 'test': tests_require, }, + python_requires=">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*", test_suite='sphinxcontrib.programoutput.tests', ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxcontrib-programoutput-0.10/src/sphinxcontrib/programoutput/__init__.py new/sphinxcontrib-programoutput-0.14/src/sphinxcontrib/programoutput/__init__.py --- old/sphinxcontrib-programoutput-0.10/src/sphinxcontrib/programoutput/__init__.py 2017-03-17 16:39:01.000000000 +0100 +++ new/sphinxcontrib-programoutput-0.14/src/sphinxcontrib/programoutput/__init__.py 2019-04-08 20:00:33.000000000 +0200 @@ -45,9 +45,11 @@ from docutils.parsers import rst from docutils.parsers.rst.directives import flag, unchanged, nonnegative_int +from sphinx.util import logging as sphinx_logging -__version__ = '0.10' +__version__ = '0.14' +logger = sphinx_logging.getLogger('contrib.programoutput') class program_output(nodes.Element): pass @@ -193,6 +195,20 @@ return result +def _prompt_template_as_unicode(app): + tmpl = app.config.programoutput_prompt_template + if isinstance(tmpl, bytes): + for enc in 'utf-8', sys.getfilesystemencoding(): + try: + tmpl = tmpl.decode(enc) + except UnicodeError: # pragma: no cover + pass + else: + app.config.programoutput_prompt_template = tmpl + break + return tmpl + + def run_programs(app, doctree): """ Execute all programs represented by ``program_output`` nodes in @@ -217,29 +233,50 @@ except EnvironmentError as error: error_message = 'Command {0} failed: {1}'.format(command, error) error_node = doctree.reporter.error(error_message, base_node=node) + # Sphinx 1.8.0b1 started dropping all system_message nodes with a + # level less than 5 by default (or 2 if `keep_warnings` is set to true). + # This appears to be undocumented. Reporting failures is an important + # part of what this extension does, so we raise the default level. + error_node['level'] = 6 node.replace_self(error_node) else: if returncode != node['returncode']: - app.warn('Unexpected return code {0} from command {1}'.format( - returncode, command)) + logger.warning( + 'Unexpected return code %s from command %s', + returncode, command + ) # replace lines with ..., if ellipsis is specified + + # Recall that `output` is guaranteed to be a unicode string on + # all versions of Python. if 'strip_lines' in node: - lines = output.splitlines() start, stop = node['strip_lines'] - lines[start:stop] = ['...'] - output = '\n'.join(lines) + lines = output.splitlines() + lines[start:stop] = [u'...'] + output = u'\n'.join(lines) if node['show_prompt']: - tmpl = app.config.programoutput_prompt_template - output = tmpl.format(command=node['command'], output=output, - returncode=returncode) + # The command in the node is also guaranteed to be + # unicode, but the prompt template might not be. This + # could be a native string on Python 2, or one with an + # explicit b prefix on 2 or 3 (for some reason). + # Attempt to decode it using UTF-8, preferentially, or + # fallback to sys.getfilesystemencoding(). If all that fails, fall back + # to the default encoding (which may have often worked before). + prompt_template = _prompt_template_as_unicode(app) + output = prompt_template.format( + command=node['command'], + output=output, + returncode=returncode + ) new_node = node_class(output, output) new_node['language'] = 'text' node.replace_self(new_node) + def init_cache(app): """ Initialize the cache for program output at @@ -259,3 +296,7 @@ app.add_directive('command-output', ProgramOutputDirective) app.connect('builder-inited', init_cache) app.connect('doctree-read', run_programs) + metadata = { + 'parallel_read_safe': True + } + return metadata diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxcontrib-programoutput-0.10/src/sphinxcontrib/programoutput/tests/__init__.py new/sphinxcontrib-programoutput-0.14/src/sphinxcontrib/programoutput/tests/__init__.py --- old/sphinxcontrib-programoutput-0.10/src/sphinxcontrib/programoutput/tests/__init__.py 2017-03-17 16:39:01.000000000 +0100 +++ new/sphinxcontrib-programoutput-0.14/src/sphinxcontrib/programoutput/tests/__init__.py 2019-04-08 20:00:33.000000000 +0200 @@ -3,12 +3,16 @@ import shutil import tempfile +from docutils import nodes from docutils.parsers.rst import directives +from docutils.parsers.rst import roles from sphinx.application import Sphinx from functools import update_wrapper # pylint:disable=no-self-use,protected-access,too-few-public-methods +# useless-object-inheritance is version specific +# pylint:disable=bad-option-value,useless-object-inheritance class Lazy(object): @@ -49,20 +53,60 @@ html_theme = 'default' """ +def _find_duplicate_default_nodes(): + from sphinx import addnodes + class App(object): + + def __init__(self): + self.nodes = set() + + def add_node(self, node): + self.nodes.add(node.__name__) + + + app = App() + try: + addnodes.setup(app) + except AttributeError: + # Sphinx 1 doesn't have this + pass + + return app.nodes class AppMixin(object): + #: The contents of the main 'doc.rst' document. + #: + #: This will be written as a bytestring to the document, allowing for + #: the document to be in an arbitrary encoding. + #: + #: If this object is not a bytestring, it will first be encoded using + #: the encoding named in `self.document_encoding`. document_content = '=============\ndummy content\n=============\n' + document_encoding = 'utf-8' + + duplicate_nodes_to_remove = _find_duplicate_default_nodes() + def setUp(self): # Avoid "WARNING: while setting up extension # sphinxcontrib.programoutput: directive u'program-output' is # already registered, it will be overridden". + # This may only be needed for Sphinx 1. self.directives = directives._directives.copy() + # Likewise for 'eq' + self.roles = roles._roles.copy() + + # Avoid "node class 'toctree' is already registered, its visitors will be overridden" + # By default this class has *no* `visit_` methods + for node in self.duplicate_nodes_to_remove: + if hasattr(nodes.GenericNodeVisitor, 'visit_' + node): + delattr(nodes.GenericNodeVisitor, 'visit_' + node) def tearDown(self): directives._directives = self.directives + roles._roles = self.roles @Lazy def tmpdir(self): @@ -90,11 +134,16 @@ content_directory = os.path.join(srcdir, 'content') os.mkdir(content_directory) content_document = os.path.join(content_directory, 'doc.rst') - with open(content_document, 'w') as f: - f.write("=====\n") - f.write("Title\n") - f.write("=====\n\n") - f.write(self.document_content) + contents = self.document_content + if not isinstance(contents, bytes): + contents = contents.encode(self.document_encoding) + + with open(content_document, 'wb') as f: + f.write(b"=====\n") + f.write(b"Title\n") + f.write(b"=====\n\n") + + f.write(contents) return srcdir @@ -135,7 +184,7 @@ @Lazy def ignore_warnings(self): - return False + return True @Lazy def doctree(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxcontrib-programoutput-0.10/src/sphinxcontrib/programoutput/tests/test_directive.py new/sphinxcontrib-programoutput-0.14/src/sphinxcontrib/programoutput/tests/test_directive.py --- old/sphinxcontrib-programoutput-0.10/src/sphinxcontrib/programoutput/tests/test_directive.py 2017-03-17 16:39:01.000000000 +0100 +++ new/sphinxcontrib-programoutput-0.14/src/sphinxcontrib/programoutput/tests/test_directive.py 2019-04-08 20:00:33.000000000 +0200 @@ -244,11 +244,12 @@ @with_content("""\ - .. program-output:: python -c 'import sys; sys.exit(1)'""") + .. program-output:: python -c 'import sys; sys.exit(1)'""", + ignore_warnings=False) def test_unexpected_return_code(self): with self.assertRaises(SphinxWarning) as excinfo: self.app.build() - self.assertIn('WARNING: Unexpected return code 1 from command', + self.assertIn('Unexpected return code 1 from command', excinfo.exception.args[0]) self.assertIn("python -c 'import sys; sys.exit(1)'", excinfo.exception.args[0]) @@ -256,17 +257,16 @@ @with_content("""\ .. program-output:: python -c 'import sys; sys.exit(1)' - :shell:""") + :shell:""", + ignore_warnings=False) def test_shell_with_unexpected_return_code(self): with self.assertRaises(SphinxWarning) as excinfo: self.app.build() - self.assertIn('WARNING: Unexpected return code 1 from command', + self.assertIn('Unexpected return code 1 from command', excinfo.exception.args[0]) self.assertIn("python -c 'import sys; sys.exit(1)'", excinfo.exception.args[0]) - - @with_content("""\ .. program-output:: python -c 'import sys; print("foo"); sys.exit(1)' :returncode: 1""") @@ -275,7 +275,6 @@ self.assert_cache(self.app, 'python -c \'import sys; print("foo"); sys.exit(1)\'', 'foo', returncode=1) - @with_content("""\ .. command-output:: python -c 'import sys; sys.exit(1)' :returncode: 1""", @@ -290,12 +289,11 @@ self.assert_cache(app, "python -c 'import sys; sys.exit(1)'", '', returncode=1) - @with_content(u".. program-output:: 'spam with eggs'", ignore_warnings=True) def test_non_existing_executable(self): # check that a proper error message appears in the document message = self.doctree.next_node(system_message) - assert message + self.assertTrue(message) srcfile = os.path.join(self.srcdir, 'content', 'doc.rst') self.assertEqual(message['source'], srcfile) self.assertEqual(message['line'], 5) @@ -305,7 +303,6 @@ self.assertIn('spam with eggs', message_text) self.assertIn("Errno", message_text) - @with_content("""\ .. program-output:: echo spam :cwd: ./subdir""", ignore_warnings=True) @@ -314,7 +311,7 @@ doctree = self.doctree srcdir = self.srcdir message = doctree.next_node(system_message) - assert message + self.assertTrue(message) srcfile = os.path.join(srcdir, 'content', 'doc.rst') self.assertEqual(message['source'], srcfile) self.assertEqual(message['line'], 5) @@ -324,6 +321,45 @@ self.assertIn('subdir', message_text) self.assertIn("No such file or directory", message_text) + @with_content(u'.. command-output:: echo "U+2264 ≤ LESS-THAN OR EQUAL TO"') + def test_default_prompt_with_unicode_output(self): + self.assert_output( + self.doctree, u"""\ +$ echo "U+2264 ≤ LESS-THAN OR EQUAL TO" +U+2264 ≤ LESS-THAN OR EQUAL TO""") + self.assert_cache( + self.app, + u'echo "U+2264 ≤ LESS-THAN OR EQUAL TO"', + u'U+2264 ≤ LESS-THAN OR EQUAL TO') + + @with_content(u'.. command-output:: echo "U+2264 ≤ LESS-THAN OR EQUAL TO"', + programoutput_prompt_template=b'> {command}\n{output}') + def test_bytes_prompt_with_unicode_output(self): + self.assert_output( + self.doctree, u"""\ +> echo "U+2264 ≤ LESS-THAN OR EQUAL TO" +U+2264 ≤ LESS-THAN OR EQUAL TO""") + self.assert_cache( + self.app, + u'echo "U+2264 ≤ LESS-THAN OR EQUAL TO"', + u'U+2264 ≤ LESS-THAN OR EQUAL TO') + + @with_content("""\ + .. program-output:: echo -e "U+2264 ≤ LESS-THAN OR EQUAL TO\\n≤ line2\\n≤ line3" + :ellipsis: 2 + """) + def test_unicode_output_with_ellipsis(self): + self.assert_output( + self.doctree, u"""\ +U+2264 \u2264 LESS-THAN OR EQUAL TO\n\u2264 line2\n...""" + ) + self.assert_cache( + self.app, + u'echo -e "U+2264 ≤ LESS-THAN OR EQUAL TO\\n≤ line2\\n≤ line3"', + u'U+2264 \u2264 LESS-THAN OR EQUAL TO\n\u2264 line2\n\u2264 line3' + ) + + def test_suite(): return unittest.defaultTestLoader.loadTestsFromName(__name__) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxcontrib-programoutput-0.10/src/sphinxcontrib/programoutput/tests/test_setup.py new/sphinxcontrib-programoutput-0.14/src/sphinxcontrib/programoutput/tests/test_setup.py --- old/sphinxcontrib-programoutput-0.10/src/sphinxcontrib/programoutput/tests/test_setup.py 2017-03-17 16:39:01.000000000 +0100 +++ new/sphinxcontrib-programoutput-0.14/src/sphinxcontrib/programoutput/tests/test_setup.py 2019-04-08 20:00:33.000000000 +0200 @@ -36,8 +36,8 @@ def test_init_cache(self): app = self.app - assert isinstance(app.env.programoutput_cache, ProgramOutputCache) - assert not app.env.programoutput_cache + self.assertIsInstance(app.env.programoutput_cache, ProgramOutputCache) + self.assertFalse(app.env.programoutput_cache) def test_suite(): return unittest.defaultTestLoader.loadTestsFromName(__name__) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxcontrib-programoutput-0.10/src/sphinxcontrib_programoutput.egg-info/PKG-INFO new/sphinxcontrib-programoutput-0.14/src/sphinxcontrib_programoutput.egg-info/PKG-INFO --- old/sphinxcontrib-programoutput-0.10/src/sphinxcontrib_programoutput.egg-info/PKG-INFO 2017-03-17 16:39:01.000000000 +0100 +++ new/sphinxcontrib-programoutput-0.14/src/sphinxcontrib_programoutput.egg-info/PKG-INFO 2019-04-08 20:00:34.000000000 +0200 @@ -1,12 +1,13 @@ -Metadata-Version: 1.1 +Metadata-Version: 2.1 Name: sphinxcontrib-programoutput -Version: 0.10 +Version: 0.14 Summary: Sphinx extension to include program output Home-page: https://sphinxcontrib-programoutput.readthedocs.org/ -Author: Jason Madden -Author-email: jason@nextthought.com +Author: Sebastian Wiesner +Author-email: lunaryorn@gmail.com +Maintainer: Jason Madden +Maintainer-email: jason@nextthought.com License: BSD -Download-URL: https://pypi.python.org/pypi/sphinxcontrib-programoutput Description: ============================= sphinxcontrib-programoutput ============================= @@ -18,8 +19,7 @@ :target: https://coveralls.io/github/NextThought/sphinxcontrib-programoutput - - http://sphinxcontrib-programoutput.readthedocs.org + https://sphinxcontrib-programoutput.readthedocs.org A Sphinx_ extension to literally insert the output of arbitrary commands into documents, helping you to keep your command examples up to date. @@ -32,7 +32,7 @@ pip install sphinxcontrib-programoutput - The extension requires Sphinx 1.3.5 and Python 2.7 or Python 3 (Python + The extension requires Sphinx 1.7.0 and Python 2.7 or Python 3 (Python 3.5+ is tested) at least. Usage @@ -76,6 +76,126 @@ .. _PyPI: http://pypi.python.org/pypi/sphinxcontrib-programoutput .. _documentation: http://sphinxcontrib-programoutput.readthedocs.org + + ========= + Changes + ========= + + 0.14 (2019-04-08) + ================= + + - Add ``python_requires`` metadata to better allow tools like ``pip`` + to install a correct version. + + - Add support for Sphinx 2.0 on Python 3. + + - Avoid unicode errors when the program command or output produced + non-ASCII output and the configured prompt was a byte string. This + was most likely under Python 2, where the default configured prompt + is a byte string. Reported by, and patch inspired by, `issue 33 + <https://github.com/NextThought/sphinxcontrib-programoutput/issues/33>`_ + by latricewilgus. + + 0.13 (2018-12-22) + ================= + + - Drop support for Sphinx < 1.7. + + - Fix tests on Sphinx >= 1.8.0. + + - Restore error message into the document by default from failed + program runs on Sphinx >= 1.8.0b1. + + - Fix deprecation warnings on Sphinx >= 1.8. Reported in `issue 29 + <https://github.com/NextThought/sphinxcontrib-programoutput/issues/29>`_ + by miili. + + + 0.11 (2017-05-18) + ================= + + - Explicitly set ``parallel_read_safe`` to true in the extension + metadata. See `issue 25 + <https://github.com/NextThought/sphinxcontrib-programoutput/issues/25>`_. + With thanks to Adam J. Stewart and Stephen McDowell. + + 0.10 (2017-03-17) + ================= + + - Decode output from the program tolerantly, using the 'replace' + handler. Based on a `pull request + <https://github.com/habnabit/sphinxcontrib-programoutput/commit/592078e0386c2a36d50a6528b6e49d91707138bf>`_ + by Stefan C. Müller. + + + 0.9 (2017-03-15) + ================ + + - Forked and revived the project in `Gitub + <https://github.com/NextThought/sphinxcontrib-programoutput>`_. + + - Run the tests on Travis CI. Formatting and style is enforced by pylint. + + - The oldest supported and tested Sphinx version is now 1.3.5. See + `issue 17 + <https://github.com/NextThought/sphinxcontrib-programoutput/issues/17>`_. + + + - Remove support for Python 2.6, Python 3.2 and 3.3. + + - 100% test coverage. + + - Remove support for ``programoutput_use_ansi``. The + ``sphinxcontrib.ansi`` extension is no longer available on PyPI. + + 0.8 (Oct 12, 2012) + ================== + + - Migrated to GitHub + + + 0.7 (Apr 17, 2012) + ================== + + - Added ``cwd`` option to ``..program-output`` + - Working directory of executed programs defaults to documentation root now + + + 0.6 (Jan 07, 2012) + ================== + + - Python 3 support + - Require Sphinx 1.1 now + + + 0.5 (Sep 19, 2011) + ================== + + - ``programoutput_prompt_template`` is interpreted as format string now! + - Require Python 2.6 now + - Added ``returncode`` option to ``program-output`` (thanks to + Jan-Marek Glogowski) + - Support ``returncode`` formatting key in + ``programoutput_prompt_template`` + - Warn on unexpected return codes instead of raising + ``subprocess.CalledProcessError`` + - Turn fatal errors during command into document error messages + instead of crashing the build + + + 0.4.1 (Mar 11, 2011) + ==================== + + - Some source code cleanups + - Fixed installation instructions in documentation + + + 0.4 (May 21, 2010) + ================== + + - Initial release + +Keywords: sphinx cli command output program example Platform: any Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers @@ -87,7 +207,12 @@ Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Topic :: Documentation Classifier: Topic :: Utilities +Classifier: Framework :: Sphinx +Classifier: Framework :: Sphinx :: Extension +Requires-Python: >=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.* +Provides-Extra: test diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxcontrib-programoutput-0.10/src/sphinxcontrib_programoutput.egg-info/requires.txt new/sphinxcontrib-programoutput-0.14/src/sphinxcontrib_programoutput.egg-info/requires.txt --- old/sphinxcontrib-programoutput-0.10/src/sphinxcontrib_programoutput.egg-info/requires.txt 2017-03-17 16:39:01.000000000 +0100 +++ new/sphinxcontrib-programoutput-0.14/src/sphinxcontrib_programoutput.egg-info/requires.txt 2019-04-08 20:00:34.000000000 +0200 @@ -1,3 +1,3 @@ -Sphinx>=1.3.5 +Sphinx>=1.7.0 [test] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxcontrib-programoutput-0.10/tox.ini new/sphinxcontrib-programoutput-0.14/tox.ini --- old/sphinxcontrib-programoutput-0.10/tox.ini 2017-03-17 16:39:01.000000000 +0100 +++ new/sphinxcontrib-programoutput-0.14/tox.ini 2019-04-08 20:00:33.000000000 +0200 @@ -1,5 +1,5 @@ [tox] -envlist=py27,py27old,py36,pypy,doc +envlist=py27,py27old,py36,py37,pypy,doc [testenv] deps = @@ -9,7 +9,7 @@ [testenv:py27old] deps = - Sphinx == 1.3.5 + Sphinx == 1.7.0 [testenv:doc] deps =
participants (1)
-
root