diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6acff63..8f2f2c7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,12 +17,14 @@ jobs: fail-fast: false matrix: sphinx: [ "5", "6", "7", "8" ] - cmake: [ "3.20", "3.30" ] + cmake: [ "3.20", "4.1" ] os: [ "ubuntu", "macos", "windows" ] - python: [ "3.8", "3.11", "3.12" ] + python: [ "3.8", "3.12", "3.13" ] exclude: - sphinx: "8" python: "3.8" + - sphinx: "5" + python: "3.13" name: | v${{ matrix.sphinx }}-${{ matrix.cmake }} diff --git a/.versup.json b/.versup.json index fcfd889..a2e9b65 100644 --- a/.versup.json +++ b/.versup.json @@ -6,12 +6,6 @@ "version = \"[version]\"" ] ], - "setup.py": [ - [ - "version=\"([\\d\\.]+)\"", - "version=\"[version]\"" - ] - ], "doc/release/release_notes.rst": [ [ ".. release:: Upcoming", diff --git a/README.md b/README.md index 8e733f0..e8b47b4 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Sphinx CMake [![PyPi version](https://img.shields.io/pypi/v/sphinx-cmake.svg?logo=pypi&label=PyPI&logoColor=gold)](https://pypi.python.org/pypi/sphinx-cmake) -[![CMake](https://img.shields.io/badge/CMake-3.20...3.30-blue.svg?logo=CMake&logoColor=blue)](https://cmake.org) +[![CMake](https://img.shields.io/badge/CMake-3.20...4.1-blue.svg?logo=CMake&logoColor=blue)](https://cmake.org) [![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) [![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) diff --git a/build_backend.py b/build_backend.py deleted file mode 100644 index 3979aa9..0000000 --- a/build_backend.py +++ /dev/null @@ -1,9 +0,0 @@ -"""Custom backend to ensure compatibility with Python 2.7. -""" - -import sys - -if sys.version_info[0] < 3: - from setuptools.build_meta import * -else: - from hatchling.build import * diff --git a/build_config.py b/build_config.py index ecdd986..3c3f19c 100644 --- a/build_config.py +++ b/build_config.py @@ -33,7 +33,7 @@ def initialize(self, version, build_data): stream.write( "include(CMakePackageConfigHelpers)\n" "write_basic_package_version_file(\n" - f" \"{str(version_config_path)}\"\n" + f" \"{str(version_config_path.as_posix())}\"\n" f" VERSION {sphinx.__version__}\n" " COMPATIBILITY AnyNewerVersion\n" ")" diff --git a/cmake/FindSphinx.cmake b/cmake/FindSphinx.cmake index 6f46e85..cd383b0 100644 --- a/cmake/FindSphinx.cmake +++ b/cmake/FindSphinx.cmake @@ -16,7 +16,7 @@ # prepend a custom search path. # (https://cmake.org/cmake/help/latest/policy/CMP0074.html) -cmake_minimum_required(VERSION 3.20...3.30) +cmake_minimum_required(VERSION 3.20...4.1) include(FindPackageHandleStandardArgs) diff --git a/doc/release/migration_notes.rst b/doc/release/migration_notes.rst index 2d6cafe..48cc712 100644 --- a/doc/release/migration_notes.rst +++ b/doc/release/migration_notes.rst @@ -6,3 +6,10 @@ Migration notes This section will show more detailed information when relevant for switching to a new version, such as when upgrading involves backwards incompatibilities. + +.. _release/migration/1.0.0: + +Migrate to 1.0.0 +================ + +Dropped support for Python 2.x. The minimum supported version is now Python 3.7. diff --git a/doc/release/release_notes.rst b/doc/release/release_notes.rst index de7106f..eea30fc 100644 --- a/doc/release/release_notes.rst +++ b/doc/release/release_notes.rst @@ -4,6 +4,17 @@ Release Notes ************* +.. release:: Upcoming + + .. change:: new + + Added compatibility with CMake 4.1. + + .. change:: changed + + Dropped support for Python 2.x. The minimum supported version is now + Python 3.7. + .. release:: 0.2.2 :date: 2024-10-06 diff --git a/pyproject.toml b/pyproject.toml index 3c1ccb4..170064a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,18 +1,16 @@ [build-system] requires = [ - "hatchling >= 1.4; python_version >= '3'", - "setuptools >= 44; python_version < '3'", - "cmake >= 3.20, < 3.31" + "hatchling >= 1.4", + "cmake >= 3.20, < 4.2" ] -build-backend = "build_backend" -backend-path = ["."] +build-backend = "hatchling.build" [project] name = "sphinx-cmake" version = "0.2.2" description = "Provide CMake module for Sphinx" readme = "README.md" -requires-python = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, <4" +requires-python = ">=3.7, <4" license = {file = "LICENSE"} keywords = ["cmake", "sphinx", "development"] authors = [ @@ -25,8 +23,6 @@ classifiers = [ "Intended Audience :: Developers", "Topic :: Software Development :: Build Tools", "License :: OSI Approved :: MIT License", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", @@ -34,6 +30,7 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", ] [project.urls] @@ -55,4 +52,4 @@ path = "build_config.py" only-include = ["*.cmake"] [tool.hatch.build.targets.sdist] -only-include = ["cmake", "build_config.py", "build_backend.py", "setup.py"] +only-include = ["cmake", "build_config.py"] diff --git a/setup.py b/setup.py deleted file mode 100644 index 84f5cdd..0000000 --- a/setup.py +++ /dev/null @@ -1,77 +0,0 @@ -"""Setuptools config only used for Python 2.7 compatibility. -""" - -from setuptools import setup -from setuptools.command.install import install - -import os -import subprocess - - -ROOT = os.path.dirname(os.path.realpath(__file__)) -DEPENDENCIES = ["sphinx >= 1, < 9"] - - -class CreateCmakeConfig(install): - """Custom command to create and share sphinx config.""" - - def run(self): - """Execute builder.""" - import sphinx - - build_path = os.path.join(ROOT, "build") - if not os.path.exists(build_path): - os.makedirs(build_path) - - # CMake search procedure is limited to CMake package configuration files - # and does not work with modules. Hence, we are generating a - # configuration file based on the CMake modules created. - # https://cmake.org/cmake/help/latest/command/find_package.html - config_path = os.path.join(build_path, "SphinxConfig.cmake") - with open(config_path, "w") as stream: - stream.write( - "include(${CMAKE_CURRENT_LIST_DIR}/FindSphinx.cmake)\n" - ) - - # Generate CMake config version file for client to target a specific - # version of Sphinx within CMake projects. - version_config_path = os.path.join( - build_path, "SphinxConfigVersion.cmake" - ) - script_path = os.path.join( - build_path, "SphinxConfigVersionScript.cmake" - ) - with open(script_path, "w") as stream: - stream.write( - "include(CMakePackageConfigHelpers)\n" - "write_basic_package_version_file(\n" - " \"{path}\"\n" - " VERSION {version}\n" - " COMPATIBILITY AnyNewerVersion\n" - ")".format( - path=str(version_config_path), - version=sphinx.__version__, - ) - ) - - subprocess.call(["cmake", "-P", str(script_path), "-VV"]) - return install.run(self) - - -setup( - name="sphinx-cmake", - version="0.2.2", - data_files=[ - ( - "share/Sphinx/cmake", - [ - "build/SphinxConfig.cmake", - "build/SphinxConfigVersion.cmake", - "cmake/FindSphinx.cmake", - ] - ) - ], - cmdclass={"install": CreateCmakeConfig}, - install_requires=DEPENDENCIES, - setup_requires=DEPENDENCIES, -)