dev-python/docutils: Sync with Gentoo

It's from Gentoo commit 1ce59387551f21e849b9da8659dd78f2c97471c7.
This commit is contained in:
Flatcar Buildbot 2025-06-16 07:08:39 +00:00 committed by Krzesimir Nowak
parent 8b5de07747
commit 44c0527140
6 changed files with 254 additions and 1 deletions

View File

@ -1 +1,3 @@
DIST docutils-0.21.2.tar.gz 2204444 BLAKE2B 727c2f97fc5835a0ffa62e38ea85af366cd89ad1eaec0b8af8b1f3b12e6cddfddb65161ba34f9109952d37ba2cf8985f3c3b6905ebb2ac1c9a984cce3fb4d170 SHA512 7fafa331f5687448e80d299c20cdccc4b49819fa471b5f586bf0ab18c694ba43a70f58e7c76b0a70a16267585548389214e11a4998ad7fdc19a27f0f7644539c
DIST docutils-0.22rc2.tar.gz 2275875 BLAKE2B 62140304e9715e31d8be69c9b65fa382832805368cbf3c184b6319405f22d6c05a16b3b28b5444b4e498c21f4bb7baee8520ef80b445123341aaab7a6a6965d6 SHA512 fcb347d29315a5c2e9f070057962094457bdaf08693c1393a649ae24bab572be027c253deb98561c5cd5a27f2d1f994cf7dea63d0cb74c3a3993c4cea45e0a48
DIST docutils-0.22rc3.tar.gz 2278230 BLAKE2B 650373b87230bc376c785becfbe2d61e2d67e561facd364f877bd580113223e39b42053b1b5fcab09990f0fc0be9f7aebaff0fc5fdb4fd524e6f45bc4de34a89 SHA512 7fa2cdceb818a69bc1b52ee16680ce23f9d15dc51b684097b479204611e2b320d778e32d5494f88543d77bc1424ee04628680610ed2dc1f5c0798a18b8da5cbd

View File

@ -4,7 +4,7 @@
EAPI=8
DISTUTILS_USE_PEP517=flit
PYTHON_COMPAT=( python3_{10..13} pypy3 pypy3_11 )
PYTHON_COMPAT=( python3_{11..14} pypy3_11 )
inherit distutils-r1 pypi
@ -27,6 +27,14 @@ BDEPEND="
${RDEPEND}
"
PATCHES=(
# r10019 upstream
"${FILESDIR}/${P}-pygments-2.19.patch"
# this changed back at some point, but upstream didn't hit it
# because of https://sourceforge.net/p/docutils/bugs/500/
"${FILESDIR}/${P}-pillow.patch"
)
python_compile_all() {
# Generate html docs from reStructured text sources.

View File

@ -0,0 +1,61 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DISTUTILS_USE_PEP517=flit
PYTHON_COMPAT=( python3_{11..14} pypy3_11 )
inherit distutils-r1 pypi
DESCRIPTION="Python Documentation Utilities (reference reStructuredText impl.)"
HOMEPAGE="
https://docutils.sourceforge.io/
https://pypi.org/project/docutils/
"
# GPL-3+ only for emacs/rst.el
LICENSE="BSD BSD-2 GPL-3+ PSF-2.4 public-domain"
SLOT="0"
RDEPEND="
dev-python/pillow[${PYTHON_USEDEP}]
dev-python/pygments[${PYTHON_USEDEP}]
"
BDEPEND="
${RDEPEND}
"
python_compile_all() {
# Generate html docs from reStructured text sources.
# Place html4css1.css in base directory to ensure that the generated reference to it is correct.
cp docutils/writers/html4css1/html4css1.css . || die
cd tools || die
"${EPYTHON}" buildhtml.py --input-encoding=utf-8 --no-datestamp \
--stylesheet-path=../html4css1.css, --traceback ../docs || die
}
src_test() {
cd test || die
distutils-r1_src_test
}
python_test() {
"${EPYTHON}" alltests.py -v || die "Testing failed with ${EPYTHON}"
}
python_install() {
distutils-r1_python_install
# Install tools.
python_doscript tools/buildhtml.py
}
python_install_all() {
local DOCS=( *.rst )
local HTML_DOCS=( docs tools docutils/writers/html4css1/html4css1.css )
distutils-r1_python_install_all
}

View File

@ -0,0 +1,61 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DISTUTILS_USE_PEP517=flit
PYTHON_COMPAT=( python3_{11..14} pypy3_11 )
inherit distutils-r1 pypi
DESCRIPTION="Python Documentation Utilities (reference reStructuredText impl.)"
HOMEPAGE="
https://docutils.sourceforge.io/
https://pypi.org/project/docutils/
"
# GPL-3+ only for emacs/rst.el
LICENSE="BSD BSD-2 GPL-3+ PSF-2.4 public-domain"
SLOT="0"
RDEPEND="
dev-python/pillow[${PYTHON_USEDEP}]
dev-python/pygments[${PYTHON_USEDEP}]
"
BDEPEND="
${RDEPEND}
"
python_compile_all() {
# Generate html docs from reStructured text sources.
# Place html4css1.css in base directory to ensure that the generated reference to it is correct.
cp docutils/writers/html4css1/html4css1.css . || die
cd tools || die
"${EPYTHON}" buildhtml.py --input-encoding=utf-8 --no-datestamp \
--stylesheet-path=../html4css1.css, --traceback ../docs || die
}
src_test() {
cd test || die
distutils-r1_src_test
}
python_test() {
"${EPYTHON}" alltests.py -v || die "Testing failed with ${EPYTHON}"
}
python_install() {
distutils-r1_python_install
# Install tools.
python_doscript tools/buildhtml.py
}
python_install_all() {
local DOCS=( *.rst )
local HTML_DOCS=( docs tools docutils/writers/html4css1/html4css1.css )
distutils-r1_python_install_all
}

View File

@ -0,0 +1,15 @@
diff --git a/test/test_writers/test_html5_polyglot_parts.py b/test/test_writers/test_html5_polyglot_parts.py
index 7122f8469..749f541e4 100644
--- a/test/test_writers/test_html5_polyglot_parts.py
+++ b/test/test_writers/test_html5_polyglot_parts.py
@@ -43,10 +43,6 @@ if PIL:
REQUIRES_PIL = ''
ONLY_LOCAL = 'Can only read local images.'
DUMMY_PNG_NOT_FOUND = "[Errno 2] No such file or directory: 'dummy.png'"
- # Pillow reports the absolute path since version 10.3.0 (cf. [bugs: 485])
- if (tuple(int(i) for i in PIL.__version__.split('.')) >= (10, 3)):
- DUMMY_PNG_NOT_FOUND = ("[Errno 2] No such file or directory: '%s'"
- % Path('dummy.png').resolve())
SCALING_OUTPUT = 'style="width: 32.0px; height: 32.0px;" '
NO_PIL_SYSTEM_MESSAGE = ''
else:

View File

@ -0,0 +1,106 @@
From 5854d09635b3fa1048d84bba17de4c38805beccd Mon Sep 17 00:00:00 2001
From: aa-turner <aa-turner@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>
Date: Fri, 7 Mar 2025 22:49:46 +0000
Subject: [PATCH] Support Pygments 2.19 in tests
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10019 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
---
.../test_rst/test_directives/test_code.py | 16 +++++++++++-----
.../test_rst/test_directives/test_code_long.py | 7 +++----
test/test_writers/test_html5_polyglot_parts.py | 4 +---
3 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/test/test_parsers/test_rst/test_directives/test_code.py b/test/test_parsers/test_rst/test_directives/test_code.py
index a54901dfe..a714f8fc5 100755
--- a/test/test_parsers/test_rst/test_directives/test_code.py
+++ b/test/test_parsers/test_rst/test_directives/test_code.py
@@ -25,10 +25,16 @@ from docutils.utils.code_analyzer import with_pygments
if with_pygments:
import pygments
- _pv = re.match(r'^([0-9]+)\.([0-9]*)', pygments.__version__)
- PYGMENTS_2_14_PLUS = (int(_pv[1]), int(_pv[2])) >= (2, 14)
+
+ pygments_version = tuple(map(int, pygments.__version__.split('.')[:2]))
+else:
+ pygments_version = (0, 0)
+
+PYGMENTS_2_14_PLUS = pygments_version >= (2, 14)
+if pygments_version >= (2, 19):
+ def_ws = '<inline classes="whitespace">\n '
else:
- PYGMENTS_2_14_PLUS = None
+ def_ws = ' '
class ParserTestCase(unittest.TestCase):
@@ -160,14 +166,14 @@ totest['code_parsing'] = [
# and now for something completely different
print(8/2)
""",
-"""\
+f"""\
<document source="test data">
<literal_block classes="code python3 testclass" ids="my-function" names="my_function" xml:space="preserve">
<inline classes="ln">
7 \n\
<inline classes="keyword">
def
- \n\
+ {def_ws}
<inline classes="name function">
my_function
<inline classes="punctuation">
diff --git a/test/test_parsers/test_rst/test_directives/test_code_long.py b/test/test_parsers/test_rst/test_directives/test_code_long.py
index 89cb4b172..037768c01 100755
--- a/test/test_parsers/test_rst/test_directives/test_code_long.py
+++ b/test/test_parsers/test_rst/test_directives/test_code_long.py
@@ -22,8 +22,7 @@ from docutils.parsers.rst import Parser
from docutils.utils import new_document
from docutils.utils.code_analyzer import with_pygments
from test.test_parsers.test_rst.test_directives.test_code \
- import PYGMENTS_2_14_PLUS
-
+ import PYGMENTS_2_14_PLUS, def_ws
@unittest.skipUnless(with_pygments, 'needs Pygments')
class ParserTestCase(unittest.TestCase):
@@ -55,14 +54,14 @@ totest['code_parsing_long'] = [
# and now for something completely different
print(8/2)
""",
-"""\
+f"""\
<document source="test data">
<literal_block classes="code python3" xml:space="preserve">
<inline classes="ln">
7 \n\
<inline classes="keyword">
def
- \n\
+ {def_ws}
<inline classes="name function">
my_function
<inline classes="punctuation">
diff --git a/test/test_writers/test_html5_polyglot_parts.py b/test/test_writers/test_html5_polyglot_parts.py
index 7122f8469..afe504d41 100644
--- a/test/test_writers/test_html5_polyglot_parts.py
+++ b/test/test_writers/test_html5_polyglot_parts.py
@@ -14,7 +14,6 @@ standard values, and any entries with empty values.
from pathlib import Path
import os
-import re
import sys
import unittest
@@ -30,8 +29,7 @@ from docutils.utils.code_analyzer import with_pygments
if with_pygments:
import pygments
- _pv = re.match(r'^([0-9]+)\.([0-9]*)', pygments.__version__)
- if (int(_pv[1]), int(_pv[2])) >= (2, 14):
+ if tuple(map(int, pygments.__version__.split('.')[:2])) >= (2, 14):
# pygments output changed in version 2.14
with_pygments = False