Blob Blame History Raw
Name:           python-pydata-sphinx-theme
Version:        0.8.1
Release:        2%{?dist}
Summary:        Bootstrap-based Sphinx theme from the PyData community

# This project is BSD.
# The bundled bootstrap and kickass JavaScript libraries are MIT.
License:        BSD and MIT
BuildArch:      noarch
Source0:        %{url}/archive/v%{version}/pydata-sphinx-theme-%{version}.tar.gz
# Source1 and Source2 created with ./
Source1:        pydata-sphinx-theme-%{version}-vendor.tar.xz
Source2:        pydata-sphinx-theme-%{version}-vendor-licenses.txt
# Fedora-only patch: unbundle the fontawesome fonts
Patch0:         %{name}-fontawesome.patch

BuildRequires:  fontawesome5-fonts-all
BuildRequires:  gcc-c++
BuildRequires:  make
BuildRequires:  nodejs-devel
BuildRequires:  npm
BuildRequires:  python3-devel
BuildRequires:  %{py3_dist beautifulsoup4}
BuildRequires:  %{py3_dist docutils}
BuildRequires:  %{py3_dist nodeenv}
BuildRequires:  %{py3_dist packaging}
BuildRequires:  %{py3_dist pip}
BuildRequires:  %{py3_dist pytest}
BuildRequires:  %{py3_dist pytest-regressions}
BuildRequires:  %{py3_dist setuptools}
BuildRequires:  %{py3_dist sphinx}
BuildRequires:  %{py3_dist sphinx-theme-builder}
BuildRequires:  %{py3_dist wheel}
BuildRequires:  yarnpkg

# Documentation dependencies
BuildRequires:  %{py3_dist jupyter-sphinx}
BuildRequires:  %{py3_dist myst-parser}
BuildRequires:  %{py3_dist numpydoc}
BuildRequires:  %{py3_dist numpy}
BuildRequires:  %{py3_dist pandas}
BuildRequires:  %{py3_dist plotly}
BuildRequires:  %{py3_dist sphinx-sitemap}
BuildRequires:  %{py3_dist sphinxext-rediraffe}
BuildRequires:  %{py3_dist xarray}

%global _description %{expand:
This package contains a Sphinx extension for creating document components
optimized for HTML+CSS.

- The panels directive creates panels of content in a grid layout,
  utilizing both the Bootstrap 4 grid system, and cards layout.

- The link-button directive creates a clickable button, linking to a URL
  or reference, and can also be used to make an entire panel clickable.

- The dropdown directive creates content that can be toggled.

- The tabbed directive creates tabbed content.

- opticon and fa (fontawesome) roles allow for inline icons to be added.}

%description %_description

%package     -n python3-pydata-sphinx-theme
Summary:        Bootstrap-based Sphinx theme from the PyData community
Requires:       fontawesome5-fonts-all

%description -n python3-pydata-sphinx-theme %_description

%package        doc
Summary:        Documentation for %{srcname}

%description    doc
Documentation for %{srcname}.

%autosetup -n pydata-sphinx-theme-%{version} -p1 -a1
cp -p %{SOURCE2} .

# Substitute the installed nodejs version for the requested version
sed -i 's,^\(node-version = \)".*",\1"%{nodejs_version}",' pyproject.toml

# Create a node header tarball so we don't try to download it
mkdir -p node-v%{nodejs_version}/include
cp -a %{_includedir}/node node-v%{nodejs_version}/include
tar czf node-v%{nodejs_version}-headers.tar.gz node-v%{nodejs_version}
npm config set tarball $PWD/node-v%{nodejs_version}-headers.tar.gz

export YARN_CACHE_FOLDER="$PWD/.package-cache"
yarn install --offline

# Workaround deprecated md4 used in webpack
find node_modules/webpack/lib/ -type f -exec sed -i 's/md4/sha256/g' {} +

# Humor nodeenv, which wants a binary named nodejs
nodejs=$(which nodejs 2> /dev/null || :)
if [ -z "$nodejs" ]; then
  if [ -d ~/bin ]; then
    mkdir ~/bin
  ln -s %{_bindir}/node ~/bin/nodejs
python3 -m nodeenv --node=system --prebuilt --clean-src $PWD/.nodeenv


if [ -z "$nodejs" ]; then
  if [ "$PREEXISTING_BIN" = 0 ]; then
    rm -fr ~/bin
    rm ~/bin/nodejs

%pyproject_save_files pydata_sphinx_theme
sed -i '/\.gitignore/d' %{pyproject_files}
rm %{buildroot}%{python3_sitelib}/pydata_sphinx_theme/theme/pydata_sphinx_theme/static/.gitignore

# We need an installed tree before documentation building works properly
export PYTHONPATH=%{buildroot}%{python3_sitelib}
cd docs
sphinx-build -a . _build
rm _build/.buildinfo
cd -


%files -n python3-pydata-sphinx-theme -f %{pyproject_files}

%files doc
%doc docs/_build/*
%license LICENSE

* Fri May 13 2022 Jerry James <> - 0.8.1-2
- Bring back the doc subpackage

* Tue Apr 12 2022 Jerry James <> - 0.8.1-1
- Version 0.8.1
- Drop the doc subpackage due to missing dependencies
- Use yarn to install vendored JavaScript

* Fri Jan 21 2022 Fedora Release Engineering <> - 0.7.2-2
- Rebuilt for

* Thu Nov 11 2021 Jerry James <> - 0.7.2-1
- Version 0.7.2

* Sat Oct  2 2021 Jerry James <> - 0.7.1-1
- Version 0.7.1
- Drop upstreamed -sphinx4.1 and -docutils patches

* Wed Sep 22 2021 Jerry James <> - 0.6.3-2
- Add upstream -docutils patch to fix FTI (bz 2006934)

* Tue Jul 13 2021 Jerry James <> - 0.6.3-1
- Initial RPM