From 101d7f824deaceeca551a08024ffe0ed18648e26 Mon Sep 17 00:00:00 2001 From: "kujiu (@uberwald)" Date: Sun, 13 Aug 2023 16:41:02 +0200 Subject: [PATCH] Sphinx 7.x and Python 3.11 support --- CHANGES.rst | 5 + MANIFEST.in | 2 - Makefile | 21 ---- VERSION | 1 - pyproject.toml | 104 +++++++++++++++++- requirements.txt | 4 - setup.cfg | 78 ------------- __init__.py => sphinx_galleria/__init__.py | 11 +- collector.py => sphinx_galleria/collector.py | 0 directive.py => sphinx_galleria/directive.py | 0 .../locale}/fr/LC_MESSAGES/sphinx.mo | Bin .../locale}/fr/LC_MESSAGES/sphinx.po | 0 .../locale}/nl/LC_MESSAGES/sphinx.mo | Bin .../locale}/nl/LC_MESSAGES/sphinx.po | 0 {locale => sphinx_galleria/locale}/sphinx.pot | 0 .../static}/sphinxgalleria/sphinxgalleria.css | 0 .../static}/sphinxgalleria/sphinxgalleria.mjs | 0 17 files changed, 109 insertions(+), 117 deletions(-) delete mode 100644 MANIFEST.in delete mode 100644 Makefile delete mode 100644 VERSION delete mode 100644 requirements.txt delete mode 100644 setup.cfg rename __init__.py => sphinx_galleria/__init__.py (95%) rename collector.py => sphinx_galleria/collector.py (100%) rename directive.py => sphinx_galleria/directive.py (100%) rename {locale => sphinx_galleria/locale}/fr/LC_MESSAGES/sphinx.mo (100%) rename {locale => sphinx_galleria/locale}/fr/LC_MESSAGES/sphinx.po (100%) rename {locale => sphinx_galleria/locale}/nl/LC_MESSAGES/sphinx.mo (100%) rename {locale => sphinx_galleria/locale}/nl/LC_MESSAGES/sphinx.po (100%) rename {locale => sphinx_galleria/locale}/sphinx.pot (100%) rename {static => sphinx_galleria/static}/sphinxgalleria/sphinxgalleria.css (100%) rename {static => sphinx_galleria/static}/sphinxgalleria/sphinxgalleria.mjs (100%) diff --git a/CHANGES.rst b/CHANGES.rst index ce71f2f..acad19b 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,11 @@ Changes ####### +2.0.0 (*2023-08-11*) +~~~~~~~~~~~~~~~~~~~~ + +- Python 3.11 and Sphinx 7.0 support + 1.1.0 (*2021-07-24*) ~~~~~~~~~~~~~~~~~~~~ diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 4a39bdb..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,2 +0,0 @@ -include VERSION -include CHANGES diff --git a/Makefile b/Makefile deleted file mode 100644 index f9b8e55..0000000 --- a/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -PYTHON = python3 -SRCDIR = . -DISTDIR = ./dist -BUILDDIR = ./build - -all: sdist wheel - -clean: - rm -rf *.egg-info dist build - -sdist: - $(PYTHON) -m build $(SRCDIR) -o $(DISTDIR) -sn - -wheel: - $(PYTHON) -m build $(SRCDIR) -o $(BUILDDIR) -wn - -install: - pip uninstall -y sphinx-galleria - pip install $(DISTDIR)/sphinx_galleria-`cat $(SRCDIR)/VERSION`.tar.gz - -.PHONY: clean sdist wheel install diff --git a/VERSION b/VERSION deleted file mode 100644 index 9084fa2..0000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.1.0 diff --git a/pyproject.toml b/pyproject.toml index 9bf5c7e..61424cd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,102 @@ [build-system] -requires = [ - "setuptools>=56", - "wheel" +requires = ["flit_core>=3.2"] +build-backend = "flit_core.buildapi" + +[project] +name = "sphinx_galleria" +version = "2.0.0" +requires-python = ">=3.8" +dependencies = [ + "Sphinx>=7.0.0", + "Pillow" +] +license = {text = "EUPL-1.2"} +authors = [ + {name = "Nerv Project ASBL", email = "contact@nerv-project.eu"}, + {name = "kujiu"}, + {name = "ptitgnu"} +] +maintainers = [ + {name = "Nerv Project ASBL", email = "contact@nerv-project.eu"}, + {name = "kujiu"}, + {name = "ptitgnu"} +] +description = "Create image galleries with Sphinx" +readme = {file = "README.rst", content-type = "text/x-rst"} +keywords=["sphinx", "doc", "theme"] +classifiers=[ + "Framework :: Sphinx", + "Framework :: Sphinx :: Theme", + "Development Status :: 5 - Production/Stable", + "License :: OSI Approved :: European Union Public Licence 1.2 (EUPL 1.2)", + "Environment :: Console", + "Environment :: Web Environment", + "Framework :: Sphinx :: Theme", + "Intended Audience :: Developers", + "Programming Language :: Python :: 3", + "Operating System :: OS Independent", + "Topic :: Documentation", + "Topic :: Software Development :: Documentation", +] + +[project.urls] +homepage = "https://www.nerv-project.eu" +repository = "https://procrastinator.nerv-project.eu/nerv-project/sphinx_galleria" +issues = "https://procrastinator.nerv-project.eu/nerv-project/sphinx_galleria/issues" +editor = "https://www.nerv-project.eu" +changelog = "https://procrastinator.nerv-project.eu/nerv-project/sphinx_galleria/raw/branch/main/CHANGES.rst" + +[project.optional-dependencies] +tests = [ + "pytest", + "flake8", + "pylint", + "pytest-cov" +] +setup = [ + "Sphinx", + "pytest-runner", + "flake8", + "pylint", + "babel", + "flit", +] + +[project.scripts] + +[tool.pytest.ini_options] +minversion = "6.0" +addopts = "-ra -q" +testpaths = [ + "tests", +] + +[tool.babel.extract_messages] +mapping_file = "babel.cfg" +output_file = "locale/sphinx.pot" +keywords = ["_", "__", "l_", "lazy_gettext", "gettext", "ngettext"] +add_comments = "Translators:" + +[tool.babel.init_catalog] +domain = "sphinx" +input_file = "locale/sphinx.pot" +output_dir = "locale/" + +[tool.babel.update_catalog] +domain = "sphinx" +input_file = "locale/sphinx.pot" +output_dir = "locale/" + +[tool.babel.compile_catalog] +domain = "sphinx" +directory = "locale/" + +[tool.flit.sdist] +include = [ + "*.py", + "static/sphinxgalleria/*.mjs", + "static/sphinxgalleria/*.css", + "locale/*.pot", + "locale/*/LC_MESSAGES/*.po", + "locale/*/LC_MESSAGES/*.mo" ] -build-backend = "setuptools.build_meta" diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 5eb448c..0000000 --- a/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -Sphinx -Pillow -setuptools>=56 -build diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index adc53e4..0000000 --- a/setup.cfg +++ /dev/null @@ -1,78 +0,0 @@ -[metadata] -long_description = file: README.rst, CHANGES.rst -long_description_content_type = text/x-rst -license_files = - LICENSE - LICENSE-de - LICENSE-fr - LICENSE-nl -name = sphinx_galleria -version = file: VERSION -url = https://procrastinator.nerv-project.eu/nerv-project/sphinx_galleria -license = EUPL 1.2 -author = Kujiu -author_email = kujiu-pypi@kujiu.org -description = Create image galleries with Sphinx -platform = any -classifiers = - Framework :: Sphinx - Framework :: Sphinx :: Extension - Development Status :: 5 - Production/Stable - Environment :: Console - Environment :: Web Environment - Intended Audience :: Developers - License :: OSI Approved :: European Union Public Licence 1.2 (EUPL 1.2) - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Operating System :: OS Independent - Topic :: Documentation - Topic :: Software Development :: Documentation -keywords = sphinx image gallery -project_urls = - Source Code = https://procrastinator.nerv-project.eu/nerv-project/sphinx_galleria - Bug Tracker = https://procrastinator.nerv-project.eu/nerv-project/sphinx_galleria/issues - -[options] -install_requires = - Sphinx>=3.0.0 - Pillow -packages = sphinx_galleria -package_dir = - sphinx_galleria = . -# cmdclass = -# compile_catalog = babel.messages.frontend.compile_catalog, -# extract_messages = babel.messages.frontend.extract_messages, -# init_catalog = babel.messages.frontend.init_catalog, -# update_catalog = babel.messages.frontend.update_catalog - -[options.package_data] -sphinx_galleria = - VERSION - static/sphinxgalleria/*.mjs - static/sphinxgalleria/*.css - locale/*.pot - locale/*/LC_MESSAGES/*.po - locale/*/LC_MESSAGES/*.mo - -[extract_messages] -mapping_file = babel.cfg -output_file = sphinx_galleria/locale/sphinx.pot -keywords = _ __ l_ lazy_gettext gettext ngettext -add_comments = Translators: - -[init_catalog] -domain = sphinx -input_file = sphinx_galleria/locale/sphinx.pot -output_dir = sphinx_galleria/locale/ - -[update_catalog] -domain = sphinx -input_file = sphinx_galleria/locale/sphinx.pot -output_dir = sphinx_galleria/locale/ - -[compile_catalog] -domain = sphinx -directory = sphinx_galleria/locale/ diff --git a/__init__.py b/sphinx_galleria/__init__.py similarity index 95% rename from __init__.py rename to sphinx_galleria/__init__.py index 9c9d0b5..7f05ccc 100644 --- a/__init__.py +++ b/sphinx_galleria/__init__.py @@ -5,6 +5,7 @@ Create image galleries """ import os + from typing import Dict, Any from sphinx.application import Sphinx from sphinx.environment import BuildEnvironment @@ -14,13 +15,9 @@ from PIL import Image from sphinx_galleria import directive from sphinx_galleria import collector - -with open(os.path.join( - os.path.dirname(__file__), - 'VERSION')) as version_file: - __version__ = version_file.read().strip() - __version_info__ = tuple(int(v) for v in __version__.split('.')) - +import pkg_resources +__version__ = pkg_resources.get_distribution(__package__).version +__version_info__ = tuple(int(v) for v in __version__.split('.')) def copy_images_files(app: Sphinx, env: BuildEnvironment) -> None: diff --git a/collector.py b/sphinx_galleria/collector.py similarity index 100% rename from collector.py rename to sphinx_galleria/collector.py diff --git a/directive.py b/sphinx_galleria/directive.py similarity index 100% rename from directive.py rename to sphinx_galleria/directive.py diff --git a/locale/fr/LC_MESSAGES/sphinx.mo b/sphinx_galleria/locale/fr/LC_MESSAGES/sphinx.mo similarity index 100% rename from locale/fr/LC_MESSAGES/sphinx.mo rename to sphinx_galleria/locale/fr/LC_MESSAGES/sphinx.mo diff --git a/locale/fr/LC_MESSAGES/sphinx.po b/sphinx_galleria/locale/fr/LC_MESSAGES/sphinx.po similarity index 100% rename from locale/fr/LC_MESSAGES/sphinx.po rename to sphinx_galleria/locale/fr/LC_MESSAGES/sphinx.po diff --git a/locale/nl/LC_MESSAGES/sphinx.mo b/sphinx_galleria/locale/nl/LC_MESSAGES/sphinx.mo similarity index 100% rename from locale/nl/LC_MESSAGES/sphinx.mo rename to sphinx_galleria/locale/nl/LC_MESSAGES/sphinx.mo diff --git a/locale/nl/LC_MESSAGES/sphinx.po b/sphinx_galleria/locale/nl/LC_MESSAGES/sphinx.po similarity index 100% rename from locale/nl/LC_MESSAGES/sphinx.po rename to sphinx_galleria/locale/nl/LC_MESSAGES/sphinx.po diff --git a/locale/sphinx.pot b/sphinx_galleria/locale/sphinx.pot similarity index 100% rename from locale/sphinx.pot rename to sphinx_galleria/locale/sphinx.pot diff --git a/static/sphinxgalleria/sphinxgalleria.css b/sphinx_galleria/static/sphinxgalleria/sphinxgalleria.css similarity index 100% rename from static/sphinxgalleria/sphinxgalleria.css rename to sphinx_galleria/static/sphinxgalleria/sphinxgalleria.css diff --git a/static/sphinxgalleria/sphinxgalleria.mjs b/sphinx_galleria/static/sphinxgalleria/sphinxgalleria.mjs similarity index 100% rename from static/sphinxgalleria/sphinxgalleria.mjs rename to sphinx_galleria/static/sphinxgalleria/sphinxgalleria.mjs