diff --git a/prepare_vendor.sh b/prepare_vendor.sh new file mode 100755 index 0000000000000000000000000000000000000000..9a4b622924b60cd3c51fe26775b3c48c345aaf12 --- /dev/null +++ b/prepare_vendor.sh @@ -0,0 +1,102 @@ +#!/bin/bash +yum -y install nodejs-yarn spectool rpm-build + +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" +rm package-lock.json +yarn install +if [ $? -ne 0 ]; then + echo "ERROR: yarn install failed" + cleanup_and_exit 1 +fi + +echo ">>>>>> Cleanup object dirs" +find node_modules/ -type d -name "*.o.d" -execdir rm {} + +find node_modules/ -type d -name "__pycache__" -execdir rm {} + + +echo ">>>>>> Cleanup object files" +find node_modules/ -name "*.node" -execdir rm {} + + +find node_modules/ -name "*.dll" | grep -Fv signal-client | xargs rm -f +find node_modules/ -name "*.dylib" -delete +find node_modules/ -name "*.so" -delete +find node_modules/ -name "*.o" -delete +find node_modules/ -name "*.a" -delete +find node_modules/ -name "*.snyk-*.flag" -delete + +echo ">>>>>> Cleanup build info" +find node_modules/ -name "builderror.log" -delete +find node_modules/ -name "yarn-error.log" -delete +find node_modules/ -name "yarn.lock" -delete +find node_modules/ -name ".deps" -type d -execdir rm {} + +find node_modules/ -name "Makefile" -delete +find node_modules/ -name "*.target.mk" -delete +find node_modules/ -name "config.gypi" -delete +find node_modules/ -name "package.json" -exec sed -i "s#$PKG_PATH#/tmp#g" {} \; + +echo ">>>>>> Cleanup yarn tarballs" +find node_modules/ -name ".yarn-tarball.tgz" -delete + +echo ">>>>>> Cleanup source maps" +find node_modules/ -name "*.js.map" -delete +find node_modules/ -name "*.ts.map" -delete +find node_modules/ -name "*.mjs.map" -delete +find node_modules/ -name "*.cjs.map" -delete +find node_modules/ -name "*.css.map" -delete +find node_modules/ -name "*.min.map" -delete + +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 +cleanup_and_exit 0 diff --git a/pydata-sphinx-theme-0.13.3-vendor-licenses.txt b/pydata-sphinx-theme-0.13.3-vendor-licenses.txt new file mode 100644 index 0000000000000000000000000000000000000000..758988897daf2a3c1ea1d934db448ca3ceadd4b3 --- /dev/null +++ b/pydata-sphinx-theme-0.13.3-vendor-licenses.txt @@ -0,0 +1,15 @@ +yarn run v1.22.19 +$ /tmpnode_modules/.bin/license-checker --summary +├─ MIT: 327 +├─ ISC: 40 +├─ BSD-2-Clause: 16 +├─ BSD-3-Clause: 6 +├─ Apache-2.0: 4 +├─ CC0-1.0: 2 +├─ (CC-BY-4.0 AND OFL-1.1 AND MIT): 1 +├─ CC-BY-4.0: 1 +├─ CC-BY-3.0: 1 +├─ (MIT AND CC-BY-3.0): 1 +└─ 0BSD: 1 + +Done in 1.19s. diff --git a/pydata-sphinx-theme-0.13.3-vendor.tar.xz b/pydata-sphinx-theme-0.13.3-vendor.tar.xz new file mode 100644 index 0000000000000000000000000000000000000000..f24f883544e12af9e37f900e90539b770a08eee3 Binary files /dev/null and b/pydata-sphinx-theme-0.13.3-vendor.tar.xz differ diff --git a/pydata-sphinx-theme-0.13.3.tar.gz b/pydata-sphinx-theme-0.13.3.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..6012c8c744a6c213b1409cb012ab0bad60133e28 Binary files /dev/null and b/pydata-sphinx-theme-0.13.3.tar.gz differ diff --git a/python-pydata-sphinx-theme.spec b/python-pydata-sphinx-theme.spec new file mode 100644 index 0000000000000000000000000000000000000000..59cb6a4d64e98c42fb652e4e352f7cb8b483b296 --- /dev/null +++ b/python-pydata-sphinx-theme.spec @@ -0,0 +1,128 @@ +%global _empty_manifest_terminate_build 0 + +Name: python-pydata-sphinx-theme +Version: 0.13.3 +Release: 1 +Summary: Bootstrap-based Sphinx theme from the PyData community. + +License: BSD 3-Clause +URL: https://github.com/pydata/pydata-sphinx-theme +Source0: https://github.com/pydata/pydata-sphinx-theme/archive/v%{version}/pydata-sphinx-theme-%{version}.tar.gz +# Source1 and Source2 created with ./prepare_vendor.sh +Source1: pydata-sphinx-theme-%{version}-vendor.tar.xz +Source2: pydata-sphinx-theme-%{version}-vendor-licenses.txt + +BuildArch: noarch +BuildRequires: nodejs-devel +BuildRequires: nodejs-yarn +BuildRequires: npm +BuildRequires: python3-devel +BuildRequires: python3-pytest +BuildRequires: python3-setuptools +BuildRequires: python3-pip +BuildRequires: python3-wheel +BuildRequires: python3-hatchling +BuildRequires: python3-flit-core +BuildRequires: python3-nodeenv +BuildRequires: python3-sphinx-theme-builder +BuildRequires: python3-beautifulsoup4 +BuildRequires: python3-sphinx >= 6.0 +BuildRequires: python3-sphinx-basic-ng +BuildRequires: python3-sphinx-copybutton +BuildRequires: python3-sphinx-design +BuildRequires: python3-sphinx-inline-tabs +BuildRequires: python3-sphinxext-rediraffe +BuildRequires: python3-jupyter-sphinx +BuildRequires: python3-pygments >= 2.7 +BuildRequires: python3-myst-parser +BuildRequires: python3-ablog +BuildRequires: python3-pandas +BuildRequires: python3-myst-nb +BuildRequires: python3-matplotlib +BuildRequires: python3-sphinxcontrib-youtube +BuildRequires: python3-numpydoc +BuildRequires: python3-sphinx-togglebutton +BuildRequires: python3-sphinx-favicon +BuildRequires: python3-sphinx-sitemap +BuildRequires: python3-linkify-it-py + +%global _description %{expand: +as well as a Sphinx extension that allows you to write MyST Markdown in Sphinx.} + + +%description %_description + +%package -n python3-pydata-sphinx-theme +Summary: %{summary} + +%description -n python3-pydata-sphinx-theme %_description + +%package help +Summary: Documentation for %{name} +# This project is BSD 3-Clause. Other files bundled with the documentation have the +# following licenses: +# - searchindex.js: BSD-2-Clause +# - _sources/kitchen-sink/*.rst.txt: CC-BY-SA-4.0 +# - _static/basic.css: BSD-2-Clause +# - _static/clipboard.min.js: MIT +# - _static/copy*: MIT +# - _static/doctools.js: BSD-2-Clause +# - _static/jquery*.js: MIT +# - _static/language_data.js: BSD-2-Clause +# - _static/pygments.css: BSD-2-Clause +# - _static/searchtools.js: BSD-2-Clause +# - _static/underscore*.js: MIT +License: MIT AND BSD-2-Clause AND CC-BY-SA-4.0 + +%description help +Documentation for %{name}. + + +%prep +%autosetup -p1 -n pydata-sphinx-theme-%{version} -a1 +cp -p %{SOURCE2} . + +# Don't ship version control files +find . -name .gitignore -delete + +# Substitute the installed nodejs version for the requested version +sed -i 's,^\(node-version = \)".*",\1"%{nodejs_version}",' pyproject.toml + +# Use local objects.inv for intersphinx +sed -e 's|\("https://docs\.python\.org/3", \)None|\1"%{_docdir}/python3-docs/html/objects.inv"|' \ + -e 's|\("https://www\.sphinx-doc\.org/en/master", \)None|\1"%{_docdir}/python-sphinx-doc/html/objects.inv"|' \ + -i docs/conf.py + +%build +export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1 +export YARN_CACHE_FOLDER="$PWD/.package-cache" +yarn install --offline +nodeenv --node=system --prebuilt --clean-src $PWD/.nodeenv +%pyproject_build + +%install +%pyproject_install + +# Build documentation +CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}" \ +PATH="%{buildroot}%{_bindir}:$PATH" \ +PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}}" \ +PYTHONDONTWRITEBYTECODE=1 \ +%{?__pytest_addopts:PYTEST_ADDOPTS="${PYTEST_ADDOPTS:-} %{__pytest_addopts}"} \ +PYTEST_XDIST_AUTO_NUM_WORKERS=%{_smp_build_ncpus} \ +sphinx-build -b html docs html +rm -rf html/{.buildinfo,.doctrees} + +%files -n python3-pydata-sphinx-theme +%doc README.md CONTRIBUTING.md +%license LICENSE +%{python3_sitelib}/pydata_sphinx_theme +%{python3_sitelib}/pydata_sphinx_theme*.dist-info/ + +%files help +%doc html +%license LICENSE + +%changelog +* Tue Jul 11 2023 Dongxing Wang - 0.13.3-1 +- Initial package