diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f358686 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/sphinx-book-theme-*-vendor.tar.xz +/sphinx-book-theme-*.tar.gz diff --git a/919.patch b/919.patch new file mode 100644 index 0000000..002d6cc --- /dev/null +++ b/919.patch @@ -0,0 +1,24 @@ +From 6d313dd98fe04f4492066727828471c677e17159 Mon Sep 17 00:00:00 2001 +From: Dmitry Shachnev +Date: Sun, 9 Nov 2025 13:33:52 +0300 +Subject: [PATCH] Ignore PendingDeprecationWarning about parser_name + deprecation with Docutils 0.22 + +--- + pyproject.toml | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/pyproject.toml b/pyproject.toml +index 290291cf..8cd058c4 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -25,7 +25,8 @@ filterwarnings = [ + # Sphinx triggers this + '''ignore:'imghdr' is deprecated and slated for removal in Python 3\.13:DeprecationWarning''', + '''ignore:'sphinx.util.import_object' is deprecated.:PendingDeprecationWarning''', +- 'ignore:Parsing dates involving a day of month without a year specified is ambiguious:DeprecationWarning' ++ 'ignore:Parsing dates involving a day of month without a year specified is ambiguious:DeprecationWarning', ++ 'ignore:Argument "parser_name" will be removed in Docutils 2.0.:PendingDeprecationWarning', + ] + + [project] diff --git a/prepare_vendor.sh b/prepare_vendor.sh new file mode 100755 index 0000000..cd23056 --- /dev/null +++ b/prepare_vendor.sh @@ -0,0 +1,65 @@ +#!/bin/bash + +PKG_URL=$(spectool *.spec --source 0 | sed -e 's/Source0:[ ]*//g') +PKG_TARBALL=$(basename $PKG_URL) +PKG_NAME=$(rpmspec -q --queryformat="%{NAME}" *.spec --srpm | sed 's/^python-//') +PKG_VERSION=$(rpmspec -q --queryformat="%{VERSION}" *.spec --srpm) +PKG_SRCDIR="${PKG_NAME}-${PKG_VERSION}" +PKG_DIR="$PWD" +PKG_TMPDIR=$(mktemp --tmpdir -d ${PKG_NAME}-XXXXXXXX) +PKG_PATH="$PKG_TMPDIR/$PKG_SRCDIR/" + +echo "URL: $PKG_URL" +echo "TARBALL: $PKG_TARBALL" +echo "NAME: $PKG_NAME" +echo "VERSION: $PKG_VERSION" +echo "PATH: $PKG_PATH" + +cleanup_tmpdir() { + popd 2>/dev/null + rm -rf $PKG_TMPDIR + rm -rf /tmp/yarn--* +} +trap cleanup_tmpdir SIGINT + +cleanup_and_exit() { + cleanup_tmpdir + if test "$1" = 0 -o -z "$1" ; then + exit 0 + else + exit $1 + fi +} + +if [ ! -w "$PKG_TARBALL" ]; then + wget "$PKG_URL" +fi + + +mkdir -p $PKG_TMPDIR +tar -xf $PKG_TARBALL -C $PKG_TMPDIR + +cd $PKG_PATH + +export YARN_CACHE_FOLDER="$PWD/.package-cache" +echo ">>>>>> Install npm modules" +yarn install --frozen-lockfile +if [ $? -ne 0 ]; then + echo "ERROR: yarn install failed" + cleanup_and_exit 1 +fi + +echo ">>>>>> Package vendor files" +rm -f $PKG_DIR/${PKG_NAME}-${PKG_VERSION}-vendor.tar.xz +XZ_OPT="-9e -T$(nproc)" tar cJf $PKG_DIR/${PKG_NAME}-${PKG_VERSION}-vendor.tar.xz .package-cache +if [ $? -ne 0 ]; then + cleanup_and_exit 1 +fi + +yarn add license-checker +yarn license-checker --summary | sed "s#$PKG_PATH#/tmp/#g" > $PKG_DIR/${PKG_NAME}-${PKG_VERSION}-vendor-licenses.txt + +cd - + +rm -rf .package-cache node_modules +cleanup_and_exit 0 diff --git a/python-sphinx-book-theme-test.patch b/python-sphinx-book-theme-test.patch new file mode 100644 index 0000000..073d635 --- /dev/null +++ b/python-sphinx-book-theme-test.patch @@ -0,0 +1,201 @@ +--- sphinx-book-theme-1.1.4/tests/test_build/build__header-article.html.orig 2025-02-20 09:20:37.000000000 -0700 ++++ sphinx-book-theme-1.1.4/tests/test_build/build__header-article.html 2025-12-12 14:47:20.167592092 -0700 +@@ -106,22 +106,18 @@ + + + +- +- ++ ++ + + + +--- sphinx-book-theme-1.1.4/tests/test_build/build__pagetoc--page-multipletitles.html.orig 2025-02-20 09:20:37.000000000 -0700 ++++ sphinx-book-theme-1.1.4/tests/test_build/build__pagetoc--page-multipletitles.html 2025-12-12 14:56:11.217220439 -0700 +@@ -1,4 +1,4 @@ +-
++
+ +
+--- sphinx-book-theme-1.1.4/tests/test_build/header__repo-buttons--one-on.html.orig 2025-02-20 09:20:37.000000000 -0700 ++++ sphinx-book-theme-1.1.4/tests/test_build/header__repo-buttons--one-on.html 2025-12-12 14:49:48.797923063 -0700 +@@ -43,22 +43,18 @@ + + + +- +- ++ ++ +
+ + diff --git a/python-sphinx-book-theme.spec b/python-sphinx-book-theme.spec new file mode 100644 index 0000000..a83e8e9 --- /dev/null +++ b/python-sphinx-book-theme.spec @@ -0,0 +1,78 @@ +%global giturl https://github.com/executablebooks/sphinx-book-theme + +Name: python-sphinx-book-theme +Version: 1.1.4 +Release: %autorelease +Summary: Interactive book theme for Sphinx + +License: BSD-3-Clause +BuildArch: noarch +URL: https://jupyterbook.org/ +VCS: git:%{giturl}.git +Source0: %{giturl}/archive/v%{version}/sphinx-book-theme-%{version}.tar.gz +# Source1 and Source2 created with ./prepare_vendor.sh +Source1: sphinx-book-theme-%{version}-vendor.tar.xz +Source2: sphinx-book-theme-%{version}-vendor-licenses.txt +# Compatibility with docutils 0.22.3 +Patch: %{giturl}/pull/919.patch +# Adapt the tests to newer sphinx components +Patch: %{name}-test.patch + +BuildSystem: pyproject +BuildOption(generate_buildrequires): -x test +BuildOption(install): -L sphinx_book_theme + +BuildRequires: nodejs-devel +BuildRequires: nodejs-npm +BuildRequires: yarnpkg + +%global _description %{expand: +This is a lightweight Sphinx theme designed to mimic the look-and-feel of +an interactive book. It has the following primary features: + +- Bootstrap 5 for visual elements and functionality +- Flexible content layout that is inspired by beautiful online books, + such as the Edward Tufte CSS guide +- Visual classes designed for Jupyter Notebooks. Cell inputs, outputs, + and interactive functionality are all supported. +- Launch buttons for online interactivity. For pages that are built with + computational material, connect your site to an online BinderHub for + interactive content.} + +%description %_description + +%package -n python3-sphinx-book-theme +Summary: Interactive book theme for Sphinx + +%description -n python3-sphinx-book-theme %_description + +%prep +%autosetup -n sphinx-book-theme-%{version} -a1 -p1 +cp -p %{SOURCE2} . +rm src/sphinx_book_theme/theme/sphinx_book_theme/static/.gitignore + +# Relax strict version requirements +sed -i 's/==/>=/g' pyproject.toml + +# Do not run code coverage tests during an RPM build +# https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters +sed -i '/coverage/d;/pytest-cov/d' pyproject.toml + +# Substitute the installed nodejs version for the requested version +%global nodejs_version %(%{_bindir}/node -v | sed s/v//) +sed -i 's,^\(node-version = \)".*",\1"%{nodejs_version}",' pyproject.toml + +%build -p +export YARN_CACHE_FOLDER="$PWD/.package-cache" +yarn install --offline +nodeenv --node=system --prebuilt --clean-src $PWD/.nodeenv + +%check +%pytest -v + +%files -n python3-sphinx-book-theme -f %{pyproject_files} +%doc CHANGELOG.md README.md +%license LICENSE sphinx-book-theme-%{version}-vendor-licenses.txt + +%changelog +%autochangelog diff --git a/sources b/sources new file mode 100644 index 0000000..4539a34 --- /dev/null +++ b/sources @@ -0,0 +1,2 @@ +SHA512 (sphinx-book-theme-1.1.4-vendor.tar.xz) = 4efb856b81f7fa379a816af701d94b8399d97b6600c5602be84ab151d87a99cbe623355e9b048b4ce4962f2ca90bc3f6ecf5e192a1cfd26fa12fce0c2fdc8f10 +SHA512 (sphinx-book-theme-1.1.4.tar.gz) = 1fcc19f9080050b7ab7eba2b6fe0df9218ba87fe7ea2dd9bfa1cbd43d9fa777723ab0d882f94077f32564b22a8e95a6317fc490263a5a4f14766bb122c73b5bd diff --git a/sphinx-book-theme-1.1.4-vendor-licenses.txt b/sphinx-book-theme-1.1.4-vendor-licenses.txt new file mode 100644 index 0000000..2947114 --- /dev/null +++ b/sphinx-book-theme-1.1.4-vendor-licenses.txt @@ -0,0 +1,15 @@ +yarn run v1.22.22 +$ /tmp/node_modules/.bin/license-checker --summary +├─ MIT: 400 +├─ ISC: 38 +├─ Apache-2.0: 19 +├─ BSD-2-Clause: 15 +├─ BSD-3-Clause: 8 +├─ CC0-1.0: 2 +├─ CC-BY-4.0: 1 +├─ (BSD-3-Clause OR GPL-2.0): 1 +├─ CC-BY-3.0: 1 +├─ (MIT AND CC-BY-3.0): 1 +└─ 0BSD: 1 + +Done in 0.71s.