# # spec file for package python-docutils # # Copyright (c) 2025 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via https://bugs.opensuse.org/ # %{?sle15_python_module_pythons} %global flavor %{nil} %if "%{flavor}" == "test" %define psuffix -test %bcond_without test %else %define psuffix %{nil} %bcond_with test %endif %if 0%{?suse_version} > 1500 %bcond_with libalternatives %else %bcond_with libalternatives %endif Name: python-docutils%{psuffix} Version: 0.21.2 Release: 2.3 Summary: Python Documentation Utilities License: BSD-2-Clause AND Python-2.0 AND GPL-2.0-or-later AND GPL-3.0-or-later AND SUSE-Public-Domain URL: https://pypi.python.org/pypi/docutils/ Source: https://files.pythonhosted.org/packages/source/d/docutils/docutils-%{version}.tar.gz Source99: python-docutils-rpmlintrc BuildRequires: %{python_module base >= 3.9} BuildRequires: %{python_module flit-core} BuildRequires: %{python_module pip} BuildRequires: fdupes BuildRequires: python-rpm-macros %if %{with libalternatives} Requires: alts BuildRequires: alts %else Requires(pre): update-alternatives Requires(post): update-alternatives Requires(postun): update-alternatives %endif Recommends: python-Pillow Recommends: python-Pygments Recommends: python-roman BuildArch: noarch %if %{with test} BuildRequires: %{python_module docutils = %{version}} BuildRequires: %{python_module packaging} # BuildRequires: %%{python_module roman} %endif %if "%{python_flavor}" == "python3" || "%{?python_provides}" == "python3" Provides: docutils = %{version} Obsoletes: docutils < %{version} %endif %python_subpackages %description Docutils is a modular system for processing documentation into useful formats, such as HTML, XML, and LaTeX. For input Docutils supports reStructuredText, an easy-to-read, what-you-see-is-what-you-get plaintext markup syntax. %prep %autosetup -p1 -n docutils-%{version} # Remove useless ".py" ending from executables: for i in tools/rst*; do mv "$i" "${i/.py}"; done find . -name \*.mp4 -print -exec chmod -x '{}' \; find . -name \*.swp -delete # Remove shebang from non-executable files sed -i '1{/^#!/d}' \ docutils/__main__.py \ docutils/parsers/commonmark_wrapper.py \ docutils/parsers/recommonmark_wrapper.py \ docutils/utils/error_reporting.py \ docutils/utils/math/math2html.py \ docutils/utils/math/tex2unichar.py \ docutils/utils/smartquotes.py \ docutils/writers/_html_base.py \ docutils/writers/odf_odt/prepstyles.py \ docutils/writers/xetex/__init__.py %build %pyproject_wheel %install %if !%{with test} %pyproject_install for binary in docutils rst2html rst2latex rst2man rst2odt rst2pseudoxml rst2s5 rst2xetex rst2xml rst2html4 rst2html5 ; do %python_clone -a %{buildroot}%{_bindir}/$binary done %python_expand %fdupes %{buildroot}%{$python_sitelib} %endif %check %if %{with test} %python_exec test/alltests.py -v %endif %if !%{with test} # sometime ago rst2html was the master which would let fail the upgrade with master docutils in post below %pre update-alternatives --query rst2html >/dev/null 2>&1 && update-alternatives --quiet --remove-all rst2html ||: # If libalternatives is used: Removing old update-alternatives entries. %python_libalternatives_reset_alternative docutils %post %python_install_alternative docutils rst2html rst2latex rst2man rst2odt rst2pseudoxml rst2s5 rst2xetex rst2xml rst2html4 rst2html5 %postun %python_uninstall_alternative docutils %files %{python_files} %license COPYING.txt licenses/*.txt %doc FAQ.txt HISTORY.txt README.txt THANKS.txt BUGS.txt docs/* %python_alternative %{_bindir}/docutils %python_alternative %{_bindir}/rst2html %python_alternative %{_bindir}/rst2latex %python_alternative %{_bindir}/rst2man %python_alternative %{_bindir}/rst2odt %python_alternative %{_bindir}/rst2pseudoxml %python_alternative %{_bindir}/rst2s5 %python_alternative %{_bindir}/rst2xetex %python_alternative %{_bindir}/rst2xml %python_alternative %{_bindir}/rst2html4 %python_alternative %{_bindir}/rst2html5 %{python_sitelib}/docutils/ %{python_sitelib}/docutils-%{version}.dist-info %endif %changelog * Fri Jan 17 2025 Nico Krapp - fix alternatives * Wed Jan 15 2025 Nico Krapp - Use libalternatives instead of update-alternatives, bsc#1235783 * Sun Nov 3 2024 Steve Kowalik - Update to 0.21.2: * General: + Drop support for Python 3.7 and 3.8. + Provide rst2* "console_scripts" entry points (without the .py extension) instead of installing the rst2*.py front end tools in the binary PATH. + Use docutils --reader=pep --writer=pep_html for a PEP preview. + Use python -m docutils.writers.odf_odt.prepstyles to strip the page size from an ODT writer stylesheet. + Use the same CSV format for the :header: option and the main data of the "csv-table" directive. + New option "loading" for the "image" directive. Sets the new attribute loading of the doctree element. * Configuration changes: + New configuration setting root_prefix. Configurable root directory for included files. + New configuration setting sources for the "buildhtml.py" application. + Simpler and more secure input encoding default behaviour: [#] Do not use the locale encoding as fallback if Python is started in UTF-8 mode. Stop using "latin1" as second fallback. [#] Remove BOM (U+FEFF ZWNBSP at start of data) only if the input_encoding configuration setting is None, '', 'utf-8-sig', 'utf-16', or 'utf-32'. Do not remove other ZWNBSPs. * Sat Mar 30 2024 Ben Greiner - Fix update-alternatives updates: docutils is the master but rst2html from old installations can create update failures - Fix bytecode cache errors: Don't modify python scripts after install * Fri Feb 23 2024 Dan Čermák - Drop obsolete Requires & BuildRequires on python-packaging & python-xml * Fri Nov 10 2023 Steve Kowalik - Update to 0.20.1: * Include tox.ini and docutils.conf in the source package * Docutils 0.20 is the last version supporting Python 3.7 and 3.8. * Support Python 3.11 (patch #198 by Hugo van Kemenade). * New functions `rst2…()` for use as "console_scripts" `entry points`_. * Fix `previous_sibling()` method that led to invalid HTML in some cases * Fix bug #463. Spurious comma in deprecation warning. * Improved mock Sphinx module. * `Transformer.populate_from_components()` now silently ignores components that are not instances of `docutils.TransformSpec`. * Accept author names with initials like ``A. Einstein`` in the "author" `bibliographic field`_ instead of rising an error * `DanglingReferences` ignores `citation_reference` nodes if the "use_bibex" setting is active. * New utility function `xml_declaration()`. * `DependencyList.add()` accepts `pathlib.Path` instances. * Support "mod" notation for modulo operation / modulus arithmetic. * Wrap definition lists with "details" class argument in a
with the "id" and "class" values of the list node. * Use dpub-ARIA role "doc-footnote__" (instead of ARIA role "note") for footnotes. * Do not load the `inputenc` package in UTF-8 encoded LaTeX sources. (UTF-8 is the default encoding for LaTeX2e since 2018). * Fix behaviour of the use_bibtex_ setting. * Outsource parts of `depart_document()` to new auxiliary methods `make_title()` and `append_bibliography()`. * Drop ``\usepackage{fixltx2e}`` from template. * Fix SetuptoolsDeprecationWarning: ``Installing '' as data is deprecated`` by adding data directories to package_data.packages list. * Refactored tests to use common `unittest` idioms. - Drop pygments-2.14.patch, no longer needed. * Fri Oct 13 2023 Matej Cepl - python-roman is not actually necessary for testing. * Fri Apr 21 2023 Dirk Müller - add sle15_python_module_pythons (jsc#PED-68) * Sun Apr 16 2023 Matej Cepl - Update single spec from Factory * Tue Jan 24 2023 Steve Kowalik - Refactor pygments-2.14.patch to not use distutils. * Tue Jan 10 2023 Daniel Garcia - Delete sphix-6.0.0.patch - Add pygments-2.14.patch - The patch is related to pygments not Sphinx and the patch is updated to make it conditional so it work with older versions of pygments, shp#docutils#201 * Wed Jan 4 2023 Daniel Garcia - Add sphinx-6.0.0.patch to fix tests for new version of sphinx. * Wed Nov 2 2022 Matej Cepl - Release 0.19 (2022-07-05) - General - Dropped support for Python 2.7, 3.5, and 3.6. and removed compatibility hacks from code and tests. - Code cleanup, check PEP 8 conformity with flake8 (exceptions in file tox.ini). - New module. Support for python -m docutils. Also used for the docutils console script entry point. - Let Publisher.publish() print info and prompt when waiting for input from a terminal (cf. https://clig.dev/#interactivity). - Respect "input_encoding_error_handler" setting when opening a source. - New function error_string() obsoletes utils.error_reporting.ErrorString. - Class ErrorOutput moved here from utils/error_reporting. - Use "utf-8-sig" instead of Python's default encoding if the "input_encoding" setting is None. - Fix error when reading of UTF-16 encoded source without trailing newline. - Aliases "markdown" and "commonmark" point to "commonmark_wrapper". - Alias for the "myst" parser (https://pypi.org/project/myst-docutils). - Use absolute module names in _parser_aliases instead of two import attempts. (Keeps details if the recommonmark_wrapper.py module raises an ImportError.) - Prepend parser name to ImportError if importing a parser class fails. - New module for parsing CommonMark input. Selects a locally installed 3rd-party parser (pycmark, myst, or recommonmark). - Raise ImportError, if import of the upstream parser module fails. If called from an "include" directive, the system-message now has source/line info. - Adapt to and test with "recommonmark" versions 0.6.0 and 0.7.1. - Update PEP base URL (fixes bug #445), use "https:" scheme in RFC base URL. - Add reporter to Directive class attributes. - parser_name() keeps details if converting ImportError to ValueError. - Don't use mutable default values for function arguments. Fixes bug #430. - Fix bug #435: invalid references in problematic nodes with report_level=4. - decode_path() returns str instance instead of nodes.reprunicode. - Add deprecation warning. - Add "html writers" to config_section_dependencies. Fixes bug #443. - Write table column widths with 3 digits precision. Fixes bug #444. - Add space before "charset" meta tag closing sequence. - Remove class value "controls" from an image node with video content after converting it to a "control" attribute of the