From 578ae7f03da8cbb980291e34041cb1fc256538e5 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Thu, 17 Aug 2023 12:09:50 -0400 Subject: [PATCH 1/6] FIX: Fix Path use for Sphinx 7.2 --- sphinx_sitemap/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sphinx_sitemap/__init__.py b/sphinx_sitemap/__init__.py index 1b5960a..5c2411e 100644 --- a/sphinx_sitemap/__init__.py +++ b/sphinx_sitemap/__init__.py @@ -12,6 +12,7 @@ # all copies or substantial portions of the Software. import os +from pathlib import Path import queue from multiprocessing import Manager from typing import Any, Dict, List, Optional @@ -210,7 +211,7 @@ def create_sitemap(app: Sphinx, exception): href=site_url + scheme.format(lang=lang, version=version, link=link), ) - filename = app.outdir + "/" + app.config.sitemap_filename + filename = Path(app.outdir) / app.config.sitemap_filename ElementTree.ElementTree(root).write( filename, xml_declaration=True, encoding="utf-8", method="xml" ) From 221fd3a6e12e04b532e5c5ba89ed34d75994ef5a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 17 Aug 2023 16:10:17 +0000 Subject: [PATCH 2/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- sphinx_sitemap/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sphinx_sitemap/__init__.py b/sphinx_sitemap/__init__.py index 5c2411e..cf20fcc 100644 --- a/sphinx_sitemap/__init__.py +++ b/sphinx_sitemap/__init__.py @@ -12,9 +12,9 @@ # all copies or substantial portions of the Software. import os -from pathlib import Path import queue from multiprocessing import Manager +from pathlib import Path from typing import Any, Dict, List, Optional from xml.etree import ElementTree From c6fe81a5523c8c38d3ce4d5244865a256d3338cc Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Thu, 17 Aug 2023 12:15:08 -0400 Subject: [PATCH 3/6] FIX: os.listdir --- tests/test_parallel_mode.py | 3 ++- tests/test_simple.py | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/test_parallel_mode.py b/tests/test_parallel_mode.py index a0beed2..0a1e480 100644 --- a/tests/test_parallel_mode.py +++ b/tests/test_parallel_mode.py @@ -1,3 +1,4 @@ +import os from xml.etree import ElementTree as etree import pytest @@ -12,7 +13,7 @@ def test_parallel(app, status, warning): app.parallel = 2 app.warningiserror = True app.build() - assert "sitemap.xml" in app.outdir.listdir() + assert "sitemap.xml" in os.listdir(app.outdir) doc = etree.parse(app.outdir / "sitemap.xml") urls = { e.text diff --git a/tests/test_simple.py b/tests/test_simple.py index 633994f..eb83a56 100644 --- a/tests/test_simple.py +++ b/tests/test_simple.py @@ -1,3 +1,4 @@ +import os from xml.etree import ElementTree as etree import pytest @@ -11,7 +12,7 @@ def test_simple_html(app, status, warning): app.warningiserror = True app.build() - assert "sitemap.xml" in app.outdir.listdir() + assert "sitemap.xml" in os.listdir(app.outdir) doc = etree.parse(app.outdir / "sitemap.xml") urls = { e.text @@ -46,7 +47,7 @@ def test_simple_html(app, status, warning): def test_html_file_suffix(app, status, warning): app.warningiserror = True app.build() - assert "sitemap.xml" in app.outdir.listdir() + assert "sitemap.xml" in os.listdir(app.outdir) doc = etree.parse(app.outdir / "sitemap.xml") urls = { e.text @@ -77,7 +78,7 @@ def test_html_file_suffix(app, status, warning): def test_simple_dirhtml(app, status, warning): app.warningiserror = True app.build() - assert "sitemap.xml" in app.outdir.listdir() + assert "sitemap.xml" in os.listdir(app.outdir) doc = etree.parse(app.outdir / "sitemap.xml") urls = { e.text From f51067e9fc49625518249dc8e5002e601bb71360 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Thu, 17 Aug 2023 13:48:21 -0400 Subject: [PATCH 4/6] MAINT: Test Sphinx versions --- .github/workflows/continuous-integration.yml | 22 ++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 09de475..20decf4 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -21,6 +21,16 @@ jobs: strategy: matrix: python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] + sphinx-version: [''] + include: + - python-version: '3.11' + sphinx-version: 'dev' + - python-version: '3.10' + sphinx-version: '7' + - python-version: '3.10' + sphinx-version: '6' + - python-version: '3.9' + sphinx-version: '5' steps: - uses: actions/checkout@v2 - name: Setup Python versions @@ -29,11 +39,19 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install Python dependencies run: | - set -xe + set -eo pipefail + if [[ ${{ matrix.sphinx-version }} != "" ]]; then + if [[ ${{ matrix.sphinx-version }} == "dev" ]]; then + SPHINX_INSTALL="git+https://github.com/sphinx-doc/sphinx.git" + else + SPHINX_INSTALL="sphinx==${{ matrix.sphinx-version }}.*" + fi + fi + set -x python -VV python -m site python -m pip install --upgrade pip setuptools wheel - pip install -r requirements_dev.txt + pip install -r requirements_dev.txt $SPHINX_INSTALL - name: Install Package run: | python -m pip install . From 9c2b8841e40266dac2b7c59ea17e7097801536a5 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Thu, 17 Aug 2023 13:50:14 -0400 Subject: [PATCH 5/6] FIX: Indent and versions --- .github/workflows/continuous-integration.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 20decf4..94e83d8 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -22,15 +22,15 @@ jobs: matrix: python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] sphinx-version: [''] - include: - - python-version: '3.11' - sphinx-version: 'dev' - - python-version: '3.10' - sphinx-version: '7' - - python-version: '3.10' - sphinx-version: '6' - - python-version: '3.9' - sphinx-version: '5' + include: + - python-version: '3.11' + sphinx-version: 'dev' + - python-version: '3.10' + sphinx-version: '7' + - python-version: '3.9' + sphinx-version: '6' + - python-version: '3.8' + sphinx-version: '5' steps: - uses: actions/checkout@v2 - name: Setup Python versions From 57b7bd89d79625a570d2fee2fd383ea2685ca925 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Thu, 17 Aug 2023 14:02:29 -0400 Subject: [PATCH 6/6] FIX: Quote --- .github/workflows/continuous-integration.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 94e83d8..57ea706 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -40,8 +40,8 @@ jobs: - name: Install Python dependencies run: | set -eo pipefail - if [[ ${{ matrix.sphinx-version }} != "" ]]; then - if [[ ${{ matrix.sphinx-version }} == "dev" ]]; then + if [[ "${{ matrix.sphinx-version }}" != "" ]]; then + if [[ "${{ matrix.sphinx-version }}" == "dev" ]]; then SPHINX_INSTALL="git+https://github.com/sphinx-doc/sphinx.git" else SPHINX_INSTALL="sphinx==${{ matrix.sphinx-version }}.*"