From 4862da883f8c984e8f15a8643c61702f90947d6c Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Wed, 2 Aug 2023 01:55:23 +0100 Subject: [PATCH 1/5] Bump version --- CHANGES | 21 +++++++++++++++++++++ sphinx/__init__.py | 6 +++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index fe66c6470..443ef7d68 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,24 @@ +Release 7.1.2 (in development) +============================== + +Dependencies +------------ + +Incompatible changes +-------------------- + +Deprecated +---------- + +Features added +-------------- + +Bugs fixed +---------- + +Testing +------- + Release 7.1.1 (released Jul 27, 2023) ===================================== diff --git a/sphinx/__init__.py b/sphinx/__init__.py index f10dd0471..48f64eb9b 100644 --- a/sphinx/__init__.py +++ b/sphinx/__init__.py @@ -19,7 +19,7 @@ warnings.filterwarnings('ignore', "'U' mode is deprecated", warnings.filterwarnings('ignore', 'The frontend.Option class .*', DeprecationWarning, module='docutils.frontend') -__version__ = '7.1.1' +__version__ = '7.1.2' __display_version__ = __version__ # used for command line version #: Version info for better programmatic use. @@ -30,11 +30,11 @@ __display_version__ = __version__ # used for command line version #: #: .. versionadded:: 1.2 #: Before version 1.2, check the string ``sphinx.__version__``. -version_info = (7, 1, 1, 'final', 0) +version_info = (7, 1, 2, 'beta', 0) package_dir = path.abspath(path.dirname(__file__)) -_in_development = False +_in_development = True if _in_development: # Only import subprocess if needed import subprocess From 4958d2abf1abb1c3a10e77d8297a746cc90d5234 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20B?= <2589111+jfbu@users.noreply.github.com> Date: Sun, 30 Jul 2023 15:00:55 +0200 Subject: [PATCH 2/5] Fix flake8 E231 reported linting failure --- sphinx/builders/linkcheck.py | 2 +- tests/test_build_linkcheck.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sphinx/builders/linkcheck.py b/sphinx/builders/linkcheck.py index 3592f9551..1b7b56eee 100644 --- a/sphinx/builders/linkcheck.py +++ b/sphinx/builders/linkcheck.py @@ -65,7 +65,7 @@ class CheckExternalLinksBuilder(DummyBuilder): output_text = path.join(self.outdir, 'output.txt') output_json = path.join(self.outdir, 'output.json') - with open(output_text, 'w', encoding='utf-8') as self.txt_outfile,\ + with open(output_text, 'w', encoding='utf-8') as self.txt_outfile, \ open(output_json, 'w', encoding='utf-8') as self.json_outfile: for result in checker.check(self.hyperlinks): self.process_result(result) diff --git a/tests/test_build_linkcheck.py b/tests/test_build_linkcheck.py index 101635597..42e4e0352 100644 --- a/tests/test_build_linkcheck.py +++ b/tests/test_build_linkcheck.py @@ -782,7 +782,7 @@ def test_too_many_requests_retry_after_HTTP_date(app, capsys): @pytest.mark.sphinx('linkcheck', testroot='linkcheck-localserver', freshenv=True) def test_too_many_requests_retry_after_without_header(app, capsys): - with http_server(make_retry_after_handler([(429, None), (200, None)])),\ + with http_server(make_retry_after_handler([(429, None), (200, None)])), \ mock.patch("sphinx.builders.linkcheck.DEFAULT_DELAY", 0): app.build() content = (app.outdir / 'output.json').read_text(encoding='utf8') From 89808c6f49e1738765d18309244dca0156ee28f6 Mon Sep 17 00:00:00 2001 From: James Addison <55152140+jayaddison@users.noreply.github.com> Date: Wed, 2 Aug 2023 02:06:49 +0100 Subject: [PATCH 3/5] Emend attribution for GH-11431 in CHANGES (#11547) --- CHANGES | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 443ef7d68..740cba322 100644 --- a/CHANGES +++ b/CHANGES @@ -65,7 +65,7 @@ Features added * ``sphinx.util.display.status_iterator`` now clears the current line with ANSI control codes, rather than overprinting with space characters. * #11431: linkcheck: Treat SSL failures as broken links. - Patch by Bénédikt Tran + Patch by James Addison. * #11157: Keep the ``translated`` attribute on translated nodes. * #11451: Improve the traceback displayed when using :option:`sphinx-build -T` in parallel builds. Patch by Bénédikt Tran From 06c1339bb36378512d2e27bcff86b6bd5db0dc0a Mon Sep 17 00:00:00 2001 From: James Addison <55152140+jayaddison@users.noreply.github.com> Date: Wed, 2 Aug 2023 02:55:37 +0100 Subject: [PATCH 4/5] Ensure that ``linkcheck_anchors`` is properly respected (#11544) Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> --- CHANGES | 4 ++++ sphinx/builders/linkcheck.py | 3 ++- tests/test_build_linkcheck.py | 17 +++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 740cba322..f31778def 100644 --- a/CHANGES +++ b/CHANGES @@ -16,6 +16,10 @@ Features added Bugs fixed ---------- +* #11542: linkcheck: Properly respect :confval:`linkcheck_anchors` + and do not spuriously report failures to validate anchors. + Patch by James Addison. + Testing ------- diff --git a/sphinx/builders/linkcheck.py b/sphinx/builders/linkcheck.py index 1b7b56eee..81b1e145f 100644 --- a/sphinx/builders/linkcheck.py +++ b/sphinx/builders/linkcheck.py @@ -406,7 +406,8 @@ class HyperlinkAvailabilityCheckWorker(Thread): _user_agent=self.user_agent, _tls_info=(self.tls_verify, self.tls_cacerts), ) as response: - if response.ok and anchor and not contains_anchor(response, anchor): + if (self.check_anchors and response.ok and anchor + and not contains_anchor(response, anchor)): raise Exception(__(f'Anchor {anchor!r} not found')) # Copy data we need from the (closed) response diff --git a/tests/test_build_linkcheck.py b/tests/test_build_linkcheck.py index 42e4e0352..04b093140 100644 --- a/tests/test_build_linkcheck.py +++ b/tests/test_build_linkcheck.py @@ -152,6 +152,7 @@ def test_defaults(app): } # looking for '#top' and '#does-not-exist' not found should fail assert rowsby["http://localhost:7777/#top"]["info"] == "Anchor 'top' not found" + assert rowsby["http://localhost:7777/#top"]["status"] == "broken" assert rowsby["http://localhost:7777#does-not-exist"]["info"] == "Anchor 'does-not-exist' not found" # images should fail assert "Not Found for url: http://localhost:7777/image.png" in rowsby["http://localhost:7777/image.png"]["info"] @@ -166,6 +167,22 @@ def test_defaults(app): } +@pytest.mark.sphinx( + 'linkcheck', testroot='linkcheck', freshenv=True, + confoverrides={'linkcheck_anchors': False}) +def test_check_link_response_only(app): + with http_server(DefaultsHandler): + app.build() + + # JSON output + assert (app.outdir / 'output.json').exists() + content = (app.outdir / 'output.json').read_text(encoding='utf8') + + rows = [json.loads(x) for x in content.splitlines()] + rowsby = {row["uri"]: row for row in rows} + assert rowsby["http://localhost:7777/#top"]["status"] == "working" + + @pytest.mark.sphinx('linkcheck', testroot='linkcheck-too-many-retries', freshenv=True) def test_too_many_retries(app): with http_server(DefaultsHandler): From 320d0b631cc7d9617f5167cc61c9284674f5b2df Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Wed, 2 Aug 2023 02:56:30 +0100 Subject: [PATCH 5/5] Bump to 7.1.2 final --- CHANGES | 19 ++----------------- sphinx/__init__.py | 4 ++-- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/CHANGES b/CHANGES index f31778def..412580f9a 100644 --- a/CHANGES +++ b/CHANGES @@ -1,17 +1,5 @@ -Release 7.1.2 (in development) -============================== - -Dependencies ------------- - -Incompatible changes --------------------- - -Deprecated ----------- - -Features added --------------- +Release 7.1.2 (released Aug 02, 2023) +===================================== Bugs fixed ---------- @@ -20,9 +8,6 @@ Bugs fixed and do not spuriously report failures to validate anchors. Patch by James Addison. -Testing -------- - Release 7.1.1 (released Jul 27, 2023) ===================================== diff --git a/sphinx/__init__.py b/sphinx/__init__.py index 48f64eb9b..18db924cc 100644 --- a/sphinx/__init__.py +++ b/sphinx/__init__.py @@ -30,11 +30,11 @@ __display_version__ = __version__ # used for command line version #: #: .. versionadded:: 1.2 #: Before version 1.2, check the string ``sphinx.__version__``. -version_info = (7, 1, 2, 'beta', 0) +version_info = (7, 1, 2, 'final', 0) package_dir = path.abspath(path.dirname(__file__)) -_in_development = True +_in_development = False if _in_development: # Only import subprocess if needed import subprocess