Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 FIX: Fix Path use for Sphinx 7.2 #70

Merged
merged 6 commits into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.9'
sphinx-version: '6'
- python-version: '3.8'
sphinx-version: '5'
steps:
- uses: actions/checkout@v2
- name: Setup Python versions
Expand All @@ -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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah cool, I didn't know about this syntax option!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI it's a BASH variable set above rather than any pip-specific option. And if it's unset (which it can be) it's just an empty string

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was bad wording on my part, I was referring to being able to use the pip command line argument to "override" the sphinx that is in requirements_dev.txt. On pip 20.0.2 I get ERROR: Double requirement given: sphinx (from -r requirements_dev.txt (line 5)) (already in sphinx==6.*, name='sphinx'), but it works on newer versions of pip so seems like a newer feature/change.

- name: Install Package
run: |
python -m pip install .
Expand Down
3 changes: 2 additions & 1 deletion sphinx_sitemap/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import os
import queue
from multiprocessing import Manager
from pathlib import Path
from typing import Any, Dict, List, Optional
from xml.etree import ElementTree

Expand Down Expand Up @@ -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"
)
Expand Down
3 changes: 2 additions & 1 deletion tests/test_parallel_mode.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from xml.etree import ElementTree as etree

import pytest
Expand All @@ -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
Expand Down
7 changes: 4 additions & 3 deletions tests/test_simple.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from xml.etree import ElementTree as etree

import pytest
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down