Skip to content

Commit f8ea921

Browse files
committed
Fix Sphinx config-mode version handling
Keep SphinxConfigVersion.cmake for config-mode checks without hard-coding a build-time sphinx version. Version discovery remains dynamic via FindSphinx.cmake. SphinxConfig.cmake stays a thin entry point. Wheel distribution is supported. Add compatibility to latest Sphinx and Cmake versions
1 parent a653e7b commit f8ea921

8 files changed

Lines changed: 26 additions & 44 deletions

File tree

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
3131
- name: Build package
3232
run: |
33-
python -m build --sdist
33+
python -m build
3434
3535
- name: Check metadata
3636
run: twine check dist/*

.github/workflows/test.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,10 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
sphinx: [ "5", "6", "7", "8" ]
19+
sphinx: [ "6", "7", "8", "9" ]
2020
cmake: [ "3.20", "4.1" ]
2121
os: [ "ubuntu", "macos", "windows" ]
22-
python: [ "3.8", "3.12", "3.13" ]
23-
exclude:
24-
- sphinx: "8"
25-
python: "3.8"
26-
- sphinx: "5"
27-
python: "3.13"
22+
python: [ "3.10", "3.14" ]
2823

2924
name: |
3025
v${{ matrix.sphinx }}-${{ matrix.cmake }}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Sphinx CMake
22

33
[![PyPi version](https://img.shields.io/pypi/v/sphinx-cmake.svg?logo=pypi&label=PyPI&logoColor=gold)](https://pypi.python.org/pypi/sphinx-cmake)
4-
[![CMake](https://img.shields.io/badge/CMake-3.20...4.1-blue.svg?logo=CMake&logoColor=blue)](https://cmake.org)
4+
[![CMake](https://img.shields.io/badge/CMake-3.20...4.2-blue.svg?logo=CMake&logoColor=blue)](https://cmake.org)
55
[![Test](https://github.com/python-cmake/sphinx-cmake/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/python-cmake/sphinx-cmake/actions/workflows/test.yml)
66
[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
77

build_config.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
22

33
import pathlib
4-
import subprocess
54

65

76
class BuildConfig(BuildHookInterface):
87
"""Builder to create and share sphinx config."""
98

109
def initialize(self, version, build_data):
1110
"""Execute builder."""
12-
import sphinx
1311

1412
root = pathlib.Path(__file__).parent.resolve()
1513
build_path = (root / "build")
@@ -25,18 +23,10 @@ def initialize(self, version, build_data):
2523
"include(${CMAKE_CURRENT_LIST_DIR}/FindSphinx.cmake)\n"
2624
)
2725

28-
# Generate CMake config version file for client to target a specific
29-
# version of Sphinx within CMake projects.
30-
version_config_path = (build_path / "SphinxConfigVersion.cmake")
31-
script_path = (build_path / "SphinxConfigVersionScript.cmake")
32-
with script_path.open("w", encoding="utf-8") as stream:
26+
# Always accept; actual version checks are handled by FindSphinx.cmake
27+
config_path = (build_path / "SphinxConfigVersion.cmake")
28+
with config_path.open("w", encoding="utf-8") as stream:
3329
stream.write(
34-
"include(CMakePackageConfigHelpers)\n"
35-
"write_basic_package_version_file(\n"
36-
f" \"{str(version_config_path.as_posix())}\"\n"
37-
f" VERSION {sphinx.__version__}\n"
38-
" COMPATIBILITY AnyNewerVersion\n"
39-
")"
30+
"set(PACKAGE_VERSION_COMPATIBLE TRUE)\n"
31+
"set(PACKAGE_VERSION_EXACT TRUE)\n"
4032
)
41-
42-
subprocess.call(["cmake", "-P", str(script_path), "-VV"])

cmake/FindSphinx.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# prepend a custom search path.
1717
# (https://cmake.org/cmake/help/latest/policy/CMP0074.html)
1818

19-
cmake_minimum_required(VERSION 3.20...4.1)
19+
cmake_minimum_required(VERSION 3.20...4.2)
2020

2121
include(FindPackageHandleStandardArgs)
2222

doc/installing.rst

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -60,20 +60,3 @@ Then, build the documentation with the command::
6060
View the result in your browser at::
6161

6262
file:///path/to/sphinx-build/build/doc/html/index.html
63-
64-
.. _installing/deployment:
65-
66-
Package Deployment
67-
==================
68-
69-
This package is deployed as a source on `PyPi <https://pypi.org/project/sphinx-cmake/>`_
70-
to allow dynamic adaptation of :term:`CMake` scripts based on the version of :term:`Sphinx`
71-
available at installation. Packaging it as a
72-
`wheel <https://packaging.python.org/en/latest/specifications/binary-distribution-format>`_
73-
would lock the :term:`Sphinx` version detected during the packaging and deployment process,
74-
reducing flexibility and compatibility with future versions.
75-
76-
If you wish to deploy the package as a source within a custom index, it is important to include
77-
the build requirements in your environment (e.g. "hatchling" and "cmake").
78-
79-
.. seealso:: `Package Formats <https://packaging.python.org/en/latest/discussions/package-formats>`_

doc/release/release_notes.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,19 @@ Release Notes
1111
Added support for prepending library and Python paths, and for passing
1212
arbitrary environment variables to Sphinx builds.
1313

14+
.. change:: new
15+
16+
Added compatibility with Sphinx v9 and CMake 4.2.
17+
18+
.. change:: changed
19+
20+
Updated :term:`CMake` packaging by simplifying
21+
`SphinxConfigVersion.cmake` so that version compatibility is no longer
22+
fixed at build time. Version discovery and validation are handled
23+
dynamically by `FindSphinx.cmake`, with `SphinxConfig.cmake` serving
24+
only as a thin entry point for :term:`CMake` package discovery.
25+
Wheel distribution is fully supported and recommended.
26+
1427
.. release:: 1.0.1
1528
:date: 2025-08-14
1629

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[build-system]
22
requires = [
33
"hatchling >= 1.4",
4-
"cmake >= 3.20, < 4.2"
4+
"cmake >= 3.20, < 4.3"
55
]
66
build-backend = "hatchling.build"
77

@@ -17,7 +17,7 @@ authors = [
1717
{name = "Jeremy Retailleau", email = "jeremy.retailleau@gmail.com" }
1818
]
1919
dependencies = [
20-
"sphinx >= 1, < 9",
20+
"sphinx >= 1, < 10",
2121
]
2222
classifiers = [
2323
"Intended Audience :: Developers",
@@ -31,6 +31,7 @@ classifiers = [
3131
"Programming Language :: Python :: 3.11",
3232
"Programming Language :: Python :: 3.12",
3333
"Programming Language :: Python :: 3.13",
34+
"Programming Language :: Python :: 3.14",
3435
]
3536

3637
[project.urls]

0 commit comments

Comments
 (0)