git: fc67766bbad6 - main - textproc/py-sphinx-book-theme: Convert to USE_PYTHON=pep517

From: Po-Chuan Hsieh <sunpoet_at_FreeBSD.org>
Date: Sun, 08 Sep 2024 18:45:44 UTC
The branch main has been updated by sunpoet:

URL: https://cgit.FreeBSD.org/ports/commit/?id=fc67766bbad638293e4204da08d8531bc0ca169b

commit fc67766bbad638293e4204da08d8531bc0ca169b
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2024-09-08 18:21:30 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2024-09-08 18:37:48 +0000

    textproc/py-sphinx-book-theme: Convert to USE_PYTHON=pep517
    
    - Bump PORTREVISION for package change
    
    Upstream builds this port with sphinx-theme-builder. However, it does not work
    on FreeBSD yet since the nodeenv would try to download pre-built node.js binary
    executable which is unavailable for FreeBSD. Therefore, I use flit-core with
    pre-built static files instead.
---
 textproc/py-sphinx-book-theme/Makefile             |  7 ++-
 .../files/patch-pyproject.toml                     | 11 ++++
 textproc/py-sphinx-book-theme/files/setup.py       | 69 ----------------------
 textproc/py-sphinx-book-theme/pkg-plist            | 66 ---------------------
 4 files changed, 15 insertions(+), 138 deletions(-)

diff --git a/textproc/py-sphinx-book-theme/Makefile b/textproc/py-sphinx-book-theme/Makefile
index 1a76a20d81d4..7c680b2943ac 100644
--- a/textproc/py-sphinx-book-theme/Makefile
+++ b/textproc/py-sphinx-book-theme/Makefile
@@ -1,10 +1,10 @@
 PORTNAME=	sphinx-book-theme
 PORTVERSION=	1.1.3
+PORTREVISION=	1
 CATEGORIES=	textproc python
 MASTER_SITES=	PYPI \
 		LOCAL/sunpoet:static
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
-#DISTNAME=	sphinx_book_theme-${PORTVERSION}
 DISTFILES=	sphinx_book_theme-${PORTVERSION}${EXTRACT_SUFX} \
 		sphinx_book_theme-${PORTVERSION}-static${EXTRACT_SUFX}:static
 
@@ -16,17 +16,18 @@ WWW=		https://sphinx-book-theme.readthedocs.io/en/stable/ \
 LICENSE=	BSD3CLAUSE
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
+BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}flit-core>=3.9.0:devel/py-flit-core@${PY_FLAVOR}
 RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}pydata-sphinx-theme>=0.15.2:textproc/py-pydata-sphinx-theme@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}sphinx>=5,1:textproc/py-sphinx@${PY_FLAVOR} \
 
 USES=		python:3.9+
-USE_PYTHON=	autoplist concurrent distutils
+USE_PYTHON=	autoplist concurrent pep517
 
 NO_ARCH=	yes
 WRKSRC=		${WRKDIR}/sphinx_book_theme-${PORTVERSION}
 
 post-patch:
-	@${SED} -e 's|%%PORTVERSION%%|${PORTVERSION}|' ${FILESDIR}/setup.py > ${WRKSRC}/setup.py
+	@${FIND} ${WRKSRC} -name .gitignore -delete
 
 post-install:
 	cd ${WRKDIR}/static/ && ${COPYTREE_SHARE} . ${STAGEDIR}${PYTHON_SITELIBDIR}/sphinx_book_theme/
diff --git a/textproc/py-sphinx-book-theme/files/patch-pyproject.toml b/textproc/py-sphinx-book-theme/files/patch-pyproject.toml
new file mode 100644
index 000000000000..321c4bfc005c
--- /dev/null
+++ b/textproc/py-sphinx-book-theme/files/patch-pyproject.toml
@@ -0,0 +1,11 @@
+--- pyproject.toml.orig	2024-06-12 14:08:03 UTC
++++ pyproject.toml
+@@ -1,6 +1,6 @@
+ [build-system]
+-requires = ["sphinx-theme-builder >= 0.2.0a7"]
+-build-backend = "sphinx_theme_builder"
++requires = ["flit-core >= 3.9.0"]
++build-backend = "flit_core.buildapi"
+ 
+ [tool.sphinx-theme-builder]
+ node-version = "16.13.2"
diff --git a/textproc/py-sphinx-book-theme/files/setup.py b/textproc/py-sphinx-book-theme/files/setup.py
deleted file mode 100644
index 5e8b6a744045..000000000000
--- a/textproc/py-sphinx-book-theme/files/setup.py
+++ /dev/null
@@ -1,69 +0,0 @@
-from setuptools import setup
-
-setup(
-    name = 'sphinx-book-theme',
-    version = '%%PORTVERSION%%',
-    description = 'A clean book theme for scientific explanations and documentation with Sphinx',
-    maintainer = 'Executable Books Team',
-    maintainer_email = 'executablebooks@gmail.com',
-    url = None,
-    packages = [
-        'sphinx_book_theme',
-        'sphinx_book_theme.header_buttons',
-    ],
-    package_dir = {'': 'src'},
-    package_data = {'': ['*']},
-    install_requires = [
-        'sphinx>=5',
-        'pydata-sphinx-theme>=0.15.2',
-    ],
-    extras_require = {
-        'code_style': [
-            'pre-commit'
-        ],
-        'doc': [
-            'ablog',
-            'ipywidgets',
-            'folium',
-            'numpy',
-            'matplotlib',
-            'numpydoc',
-            'myst-nb',
-            'nbclient',
-            'pandas',
-            'plotly',
-            'sphinx-design',
-            'sphinx-examples',
-            'sphinx-copybutton',
-            'sphinx-tabs'
-            'sphinx-togglebutton',
-            'sphinx-thebe',
-            'sphinxcontrib-bibtex',
-            'sphinxcontrib-youtube',
-            'sphinxext-opengraph',
-        ],
-        'test': [
-            'beautifulsoup4',
-            'coverage',
-            'defusedxml',
-            'myst-nb',
-            'pytest',
-            'pytest-cov',
-            'pytest-regressions',
-            'sphinx_thebe',
-        ],
-    },
-    entry_points = {
-        'sphinx.html_themes': ['sphinx_book_theme = sphinx_book_theme'],
-    },
-    classifiers = [
-        'Development Status :: 4 - Beta',
-        'Programming Language :: Python :: 3',
-        'Framework :: Sphinx',
-        'Framework :: Sphinx :: Theme',
-        'License :: OSI Approved :: BSD License',
-        'Operating System :: OS Independent',
-    ],
-    license = 'BSD License',
-    python_requires = '>= 3.9',
-)
diff --git a/textproc/py-sphinx-book-theme/pkg-plist b/textproc/py-sphinx-book-theme/pkg-plist
index 90ecddc28531..64c292d88b87 100644
--- a/textproc/py-sphinx-book-theme/pkg-plist
+++ b/textproc/py-sphinx-book-theme/pkg-plist
@@ -1,67 +1,3 @@
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/scripts/index.js
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/styles/abstracts/_mixins.scss
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/styles/abstracts/_variables.scss
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/styles/base/_base.scss
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/styles/base/_print.scss
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/styles/base/_typography.scss
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/styles/components/_back-to-top.scss
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/styles/components/_icon-links.scss
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/styles/components/_logo.scss
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/styles/components/_search.scss
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/styles/content/_code.scss
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/styles/content/_images.scss
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/styles/content/_margin.scss
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/styles/content/_notebooks.scss
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/styles/content/_quotes.scss
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/styles/extensions/_comments.scss
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/styles/extensions/_thebe.scss
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/styles/index.scss
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/styles/sections/_announcement.scss
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/styles/sections/_article-container.scss
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/styles/sections/_article.scss
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/styles/sections/_footer-article.scss
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/styles/sections/_footer-content.scss
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/styles/sections/_header-article.scss
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/styles/sections/_header-primary.scss
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/styles/sections/_sidebar-primary.scss
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/styles/sections/_sidebar-secondary.scss
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/translations/README.md
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/translations/jsons/By the.json
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/translations/jsons/By.json
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/translations/jsons/Contents.json
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/translations/jsons/Copyright.json
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/translations/jsons/Download notebook file.json
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/translations/jsons/Download source file.json
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/translations/jsons/Download this page.json
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/translations/jsons/Edit this page.json
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/translations/jsons/Fullscreen mode.json
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/translations/jsons/Last updated on.json
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/translations/jsons/Launch.json
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/translations/jsons/Open an issue.json
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/translations/jsons/Print to PDF.json
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/translations/jsons/Source repository.json
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/translations/jsons/Sphinx Book Theme.json
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/translations/jsons/Theme by the.json
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/translations/jsons/Toggle navigation.json
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/translations/jsons/next page.json
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/translations/jsons/open issue.json
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/translations/jsons/previous page.json
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/translations/jsons/repository.json
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/assets/translations/jsons/suggest edit.json
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/theme/sphinx_book_theme/components/article-header-buttons.html
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/theme/sphinx_book_theme/components/author.html
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/theme/sphinx_book_theme/components/extra-footer.html
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/theme/sphinx_book_theme/components/page-toc.html
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/theme/sphinx_book_theme/components/sbt-sidebar-nav.html
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/theme/sphinx_book_theme/components/toggle-primary-sidebar.html
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/theme/sphinx_book_theme/components/toggle-secondary-sidebar.html
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/theme/sphinx_book_theme/layout.html
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/theme/sphinx_book_theme/macros/buttons.html
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/theme/sphinx_book_theme/sections/footer-content.html
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/theme/sphinx_book_theme/static/images/logo_binder.svg
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/theme/sphinx_book_theme/static/images/logo_colab.png
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/theme/sphinx_book_theme/static/images/logo_deepnote.svg
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/theme/sphinx_book_theme/static/images/logo_jupyterhub.svg
 %%PYTHON_SITELIBDIR%%/sphinx_book_theme/theme/sphinx_book_theme/static/locales/ar/LC_MESSAGES/booktheme.mo
 %%PYTHON_SITELIBDIR%%/sphinx_book_theme/theme/sphinx_book_theme/static/locales/ar/LC_MESSAGES/booktheme.po
 %%PYTHON_SITELIBDIR%%/sphinx_book_theme/theme/sphinx_book_theme/static/locales/bg/LC_MESSAGES/booktheme.mo
@@ -152,9 +88,7 @@
 %%PYTHON_SITELIBDIR%%/sphinx_book_theme/theme/sphinx_book_theme/static/locales/zh_CN/LC_MESSAGES/booktheme.po
 %%PYTHON_SITELIBDIR%%/sphinx_book_theme/theme/sphinx_book_theme/static/locales/zh_TW/LC_MESSAGES/booktheme.mo
 %%PYTHON_SITELIBDIR%%/sphinx_book_theme/theme/sphinx_book_theme/static/locales/zh_TW/LC_MESSAGES/booktheme.po
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/theme/sphinx_book_theme/static/sbt-webpack-macros.html
 %%PYTHON_SITELIBDIR%%/sphinx_book_theme/theme/sphinx_book_theme/static/scripts/sphinx-book-theme.js
 %%PYTHON_SITELIBDIR%%/sphinx_book_theme/theme/sphinx_book_theme/static/scripts/sphinx-book-theme.js.map
 %%PYTHON_SITELIBDIR%%/sphinx_book_theme/theme/sphinx_book_theme/static/styles/sphinx-book-theme.css
 %%PYTHON_SITELIBDIR%%/sphinx_book_theme/theme/sphinx_book_theme/static/styles/sphinx-book-theme.css.map
-%%PYTHON_SITELIBDIR%%/sphinx_book_theme/theme/sphinx_book_theme/theme.conf