Sphinx 7 & python 3.11 support

This commit is contained in:
Kujiu 2023-08-17 01:47:45 +02:00
parent 04f3997ef8
commit e68df63e92
Signed by: kujiu
GPG key ID: ABBB2CAC6855599F
5 changed files with 112 additions and 111 deletions

View file

@ -2,6 +2,12 @@
Changes Changes
======= =======
2.0.0 (*2023-08-17*)
====================
- Sphinx 7 support
- Python 3.11 support
1.1.2 (*2021-06-02*) 1.1.2 (*2021-06-02*)
==================== ====================

99
pyproject.toml Normal file
View file

@ -0,0 +1,99 @@
[build-system]
requires = ["flit_core>=3.2"]
build-backend = "flit_core.buildapi"
[project]
name = "sphinx_gemini_builder"
version = "2.0.0"
requires-python = ">=3.8"
dependencies = [
"Sphinx>=7.0.0"
]
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 = "Build gemini blog"
readme = {file = "README.rst", content-type = "text/x-rst"}
keywords=["sphinx", "gemini", "gemlog"]
classifiers=[
"Framework :: Sphinx",
"Framework :: Sphinx :: Extension",
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: European Union Public Licence 1.2 (EUPL 1.2)",
"Environment :: Console",
"Environment :: Web Environment",
"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_gemini_builder"
issues = "https://procrastinator.nerv-project.eu/nerv-project/sphinx_gemini_builder/issues"
editor = "https://www.nerv-project.eu"
changelog = "https://procrastinator.nerv-project.eu/nerv-project/sphinx_gemini_builder/raw/branch/main/CHANGES.rst"
[project.entry-points."sphinx.builders"]
gemini = "sphinx_gemini_builder"
[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",
]

View file

@ -1,27 +0,0 @@
[metadata]
description-file = README.rst
license-files =
LICENSE
LICENSE-de
LICENSE-fr
LICENSE-nl
[extract_messages]
output_file = sphinx_gemini_builder/locale/sphinx.pot
keywords = _ __ l_ lazy_gettext gettext ngettext
add_comments = Translators:
[init_catalog]
domain = sphinx
input_file = sphinx_gemini_builder/locale/sphinx.pot
output_dir = sphinx_gemini_builder/locale/
[update_catalog]
domain = sphinx
input_file = sphinx_gemini_builder/locale/sphinx.pot
output_dir = sphinx_gemini_builder/locale/
[compile_catalog]
domain = sphinx
directory = sphinx_gemini_builder/locale/

View file

@ -1,78 +0,0 @@
from setuptools import setup
import distutils
class TranslateCommand(distutils.cmd.Command):
description = "Translation"
user_options = []
sub_commands = [
('extract_messages', None),
('update_catalog', None),
('compile_catalog', None),
]
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
for cmd_name in self.get_sub_commands():
self.run_command(cmd_name)
with open("README.rst", "r") as fh:
long_description = fh.read()
setup(
name="sphinx_gemini_builder",
version="1.1.2",
url="https://procrastinator.nerv-project.eu/nerv-project/sphinx_gemini_builder",
license="EUPL 1.2",
author="Kujiu",
author_email="kujiu-pypi@kujiu.org",
description="Build gemini blog",
long_description=long_description,
long_description_content_type="text/x-rst",
packages=["sphinx_gemini_builder"],
cmdclass={
'translate': TranslateCommand,
},
package_data={
"sphinx_gemini_builder": [
"locale/*/LC_MESSAGES/*.po",
"locale/*/LC_MESSAGES/*.mo",
]
},
entry_points={
'sphinx.builders': [
'gemini = sphinx_gemini_builder',
]
},
install_requires=["sphinx>=2.0.0"],
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.5",
"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 gemini gemlog",
project_urls={
"Source": "https://procrastinator.nerv-project.eu/nerv-project/sphinx_gemini_builder",
"Issues": "https://procrastinator.nerv-project.eu/nerv-project/sphinx_gemini_builder/issues",
},
)

View file

@ -5,10 +5,6 @@
Build Gemini blog from Sphinx. Build Gemini blog from Sphinx.
""" """
__version_info__ = (1, 1, 2)
__version__ = '.'.join([str(val) for val in __version_info__])
from os import path from os import path
from pathlib import Path from pathlib import Path
from typing import Set, Dict, Any from typing import Set, Dict, Any
@ -19,12 +15,17 @@ from sphinx.util import logging, status_iterator
from sphinx.util.osutil import copyfile, ensuredir, relative_uri from sphinx.util.osutil import copyfile, ensuredir, relative_uri
from sphinx.locale import __ from sphinx.locale import __
from sphinx.application import Sphinx from sphinx.application import Sphinx
from sphinx.environment import BuildEnvironment
from sphinx.environment.adapters.asset import ImageAdapter from sphinx.environment.adapters.asset import ImageAdapter
from docutils import nodes from docutils import nodes
from docutils.utils import relative_path from docutils.utils import relative_path
from .writer import GeminiTranslator, GeminiWriter from .writer import GeminiTranslator, GeminiWriter
import pkg_resources
__version__ = pkg_resources.get_distribution(__package__).version
__version_info__ = tuple(int(v) for v in __version__.split('.'))
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -42,8 +43,8 @@ class GeminiBuilder(TextBuilder):
current_docname = None current_docname = None
def __init__(self, app) -> None: def __init__(self, app: Sphinx, env: BuildEnvironment) -> None:
super().__init__(app) super().__init__(app, env)
self.add_footer = True self.add_footer = True
self.baseurl = self.config.gemini_baseurl self.baseurl = self.config.gemini_baseurl
self.footer_enabled = True self.footer_enabled = True