New package structure, Sphinx 8+ compatibility

This commit is contained in:
Kujiu 2023-09-17 15:01:53 +02:00
parent fd6c7de526
commit e850eb4960
Signed by: kujiu
GPG Key ID: ABBB2CAC6855599F
7 changed files with 106 additions and 111 deletions

View File

@ -1,3 +1,4 @@
(in chronological order)
* Kujiu
* PtitGNU

100
pyproject.toml Normal file
View File

@ -0,0 +1,100 @@
[build-system]
requires = ["flit_core>=3.2"]
build-backend = "flit_core.buildapi"
[project]
name = "sphinx_pyppeteer_builder"
version = "1.0.0"
requires-python = ">=3.8"
dependencies = [
"Sphinx>=7.0.0",
"pyppeteer"
]
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 = "A Sphinx PDF builder using pyppeteer"
readme = {file = "README.rst", content-type = "text/x-rst"}
keywords=["sphinx", "doc", "pdf", "pyppeteer"]
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_pyppeteer_builder"
issues = "https://procrastinator.nerv-project.eu/nerv-project/sphinx_pyppeteer_builder/issues"
editor = "https://www.nerv-project.eu"
changelog = "https://procrastinator.nerv-project.eu/nerv-project/sphinx_pyppeteer_builder/raw/branch/main/CHANGES.rst"
[project.entry-points."sphinx.builders"]
pyppeteer = "sphinx_pyppeteer_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,2 +0,0 @@
Sphinx>=3.0.0
pyppeteer

View File

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

View File

@ -1,76 +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_pyppeteer_builder",
version="0.1.1",
url="https://procrastinator.nerv-project.eu/nerv-project/sphinx_pyppeteer_builder",
license="EUPL 1.2",
author="Kujiu",
author_email="kujiu-pypi@kujiu.org",
description="A Sphinx PDF builder using pyppeteer",
long_description=long_description,
long_description_content_type="text/x-rst",
packages=["sphinx_pyppeteer_builder"],
cmdclass={
'translate': TranslateCommand,
},
package_data={
"sphinx_pyppeteer_builder": [
"locale/*/LC_MESSAGES/*.mo",
"locale/*/LC_MESSAGES/*.po",
]
},
entry_points={"sphinx.builders": ["pyppeteer = sphinx_pyppeteer_builder"]},
install_requires=[
"sphinx>=3.0.0",
"pyppeteer",
],
classifiers=[
"Framework :: Sphinx",
"Framework :: Sphinx :: Extension",
"Development Status :: 4 - Beta",
"License :: OSI Approved :: European Union Public Licence 1.2 (EUPL 1.2)",
"Environment :: Console",
"Environment :: Web Environment",
"Intended Audience :: Developers",
"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 doc pdf pyppeteer",
project_urls={
"Source": "https://procrastinator.nerv-project.eu/nerv-project/sphinx_pyppeteer_builder",
"Issues": "https://procrastinator.nerv-project.eu/nerv-project/sphinx_pyppeteer_builder/issues",
},
)

View File

@ -7,9 +7,9 @@ from typing import Dict, Any
from sphinx.application import Sphinx
from sphinx.util.osutil import make_filename
version = (0, 1, 1)
import pkg_resources
__version__ = pkg_resources.get_distribution(__package__).version
__version_info__ = tuple(int(v) for v in __version__.split('.'))
DEFAULT_PDF_OPTIONS = {
'printBackground': True,
@ -109,7 +109,7 @@ def setup(app: Sphinx) -> Dict[str, Any]:
)
return {
'version': version,
'version': __version__,
'parallel_read_safe': True,
'parallel_write_safe': True,
}

View File

@ -5,7 +5,7 @@ import asyncio
from typing import Dict, Set, Tuple
from sphinx.builders.singlehtml import SingleFileHTMLBuilder
from sphinx.util import progress_message, logging
from sphinx.util.display import progress_message, logging
from sphinx.util.osutil import os_path
from sphinx.locale import __