public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python-pydata-sphinx-theme] f44: Yet another attempt at unbundling the fonts
@ 2026-07-28 17:33 Jerry James
  0 siblings, 0 replies; only message in thread
From: Jerry James @ 2026-07-28 17:33 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/python-pydata-sphinx-theme
            Branch : f44
            Commit : 3bfdee9970b4b52bb4ebc77fab24cd1b0ef3dfce
            Author : Jerry James <loganjerry@gmail.com>
            Date   : 2026-07-28T11:33:00-06:00
            Stats  : +21/-24 in 1 file(s)
            URL    : https://src.fedoraproject.org/rpms/python-pydata-sphinx-theme/c/3bfdee9970b4b52bb4ebc77fab24cd1b0ef3dfce?branch=f44

            Log:
            Yet another attempt at unbundling the fonts

- Thanks to Corentin Noël for this approach

---
diff --git a/python-pydata-sphinx-theme.spec b/python-pydata-sphinx-theme.spec
index 9f32784..8508443 100644
--- a/python-pydata-sphinx-theme.spec
+++ b/python-pydata-sphinx-theme.spec
@@ -26,8 +26,6 @@ Source2:        pydata-sphinx-theme-%{version}-vendor-licenses.txt
 # docs/_static/gallery.yaml for a list of images to download.
 Source3:        pydata-gallery.tar.xz
 %endif
-# Fedora-only patch: unbundle the fontawesome fonts
-Patch:          %{name}-fontawesome.patch
 
 BuildArch:      noarch
 BuildSystem:    pyproject
@@ -35,8 +33,6 @@ BuildOption(install): -L pydata_sphinx_theme
 BuildOption(generate_buildrequires): -x test%{?with_docs:,doc}
 
 BuildRequires:  babel
-BuildRequires:  fontawesome-fonts-all
-BuildRequires:  fontawesome-fonts-web
 BuildRequires:  gcc-c++
 BuildRequires:  make
 BuildRequires:  nodejs-devel
@@ -44,8 +40,6 @@ BuildRequires:  /usr/bin/node
 BuildRequires:  /usr/bin/npm
 BuildRequires:  yarnpkg
 
-Provides:       bundled(npm(bootstrap)) = 5.3.8
-
 %if %{without docs}
 Obsoletes:      %{name}-doc < 0.13.0-1
 %endif
@@ -74,7 +68,8 @@ See https://pydata-sphinx-theme.readthedocs.io/ for documentation.}
 Summary:        Bootstrap-based Sphinx theme from the PyData community
 Requires:       fontawesome-fonts-all
 Requires:       fontawesome-fonts-web
-Provides:       bundled(js-bootstrap) = 5.3.8
+
+Provides:       bundled(npm(bootstrap)) = 5.3.8
 
 %if %{without docs}
 Obsoletes:      %{name}-doc < 0.13.0-1
@@ -126,23 +121,25 @@ nodeenv --node=system --prebuilt --clean-src $PWD/.nodeenv
 sed -i '/\.gitignore/d' %{pyproject_files}
 rm %{themedir}/.gitignore
 
-# More work is required to fully unbundle the fontawesome fonts
-sed -i 's,pydata_sphinx_theme/\.\.,,g' \
-    %{themedir}/scripts/fontawesome.js.map
-sed -e 's,pydata_sphinx_theme/\.\./\.\./\.\./\.\./\.\.,,g' \
-    -e 's,url(\\"\.\./webfonts/fa-solid-900\.woff2\\"),local("fontawesome-6-free-fonts/Font Awesome 6 Free-Solid-900") format("opentype"),g' \
-    -e 's,url(\\"\.\./webfonts/fa-regular-400\.woff2\\"),local("fontawesome-6-free-fonts/Font Awesome 6 Free-Regular-400") format("opentype"),g' \
-    -e 's,url(\\"\.\./webfonts/fa-brands-400\.woff2\\"),local("fontawesome-6-brands-fonts/Font Awesome 6 Brands-Regular-400") format("opentype"),g' \
-    -e "s,url('#{v\.\$font-path}/fa-solid-900\.woff2')"',local("fontawesome-6-free-fonts/Font Awesome 6 Free-Solid-900") format("opentype"),g' \
-    -e "s,url('#{v\.\$font-path}/fa-regular-400\.woff2')"',local("fontawesome-6-free-fonts/Font Awesome 6 Free-Regular-400") format("opentype"),g' \
-    -e "s,url('#{v\.\$font-path}/fa-brands-400\.woff2')"',local("fontawesome-6-brands-fonts/Font Awesome 6 Brands-Regular-400") format("opentype"),g' \
-    -i %{themedir}/styles/pydata-sphinx-theme.css.map
-sed -e 's,url([.-/[:alnum:]]*fa-solid-900\.woff2),local("fontawesome-6-free-fonts/Font Awesome 6 Free-Solid-900") format("opentype"),g' \
-    -e 's,url([.-/[:alnum:]]*fa-regular-400\.woff2),local("fontawesome-6-free-fonts/Font Awesome 6 Free-Regular-400") format("opentype"),g' \
-    -e 's,url([.-/[:alnum:]]*fa-brands-400\.woff2),local("fontawesome-6-brands-fonts/Font Awesome 6 Brands-Regular-400") format("opentype"),g' \
-    -i %{themedir}/styles/pydata-sphinx-theme.css
-sed -i '/vendor/d' %{pyproject_files}
-rm -fr %{themedir}/vendor
+# Clean up build-host paths leaking into the source maps
+sed -i 's|pydata_sphinx_theme/\.\.||g' %{themedir}/scripts/fontawesome.js.map
+sed -i 's|pydata_sphinx_theme/\.\./\.\./\.\./\.\./\.\.||g' \
+    %{themedir}/styles/pydata-sphinx-theme.css.map
+
+# Unbundle the FontAwesome fonts: webpack already vendors the woff2 files
+# referenced by the (Fedora-patched) SCSS/JS imports into
+# vendor/fontawesome/webfonts/, copying them from the system
+# fontawesome-fonts-web package.  Replace those copies with symlinks back to
+# that package instead of shipping duplicate binaries.  The CSS/JS keep
+# referencing them with the same relative url()/path, so nothing else needs to
+# change; Sphinx dereferences the symlinks (real files, real bytes) when it
+# copies the static assets into a project's own build output, so the generated
+# documentation stays fully self-contained.
+for font in fa-brands-400.woff2 fa-regular-400.woff2 fa-solid-900.woff2; do
+    rm -f %{themedir}/vendor/fontawesome/webfonts/$font
+    ln -s %{_datadir}/fontawesome/webfonts/$font \
+        %{themedir}/vendor/fontawesome/webfonts/$font
+done
 
 %if %{with docs}
 # We need an installed tree before documentation building works properly

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-07-28 17:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-28 17:33 [rpms/python-pydata-sphinx-theme] f44: Yet another attempt at unbundling the fonts Jerry James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox