diff --git a/furo-2023.05.20-vendor-licenses.txt b/furo-2023.05.20-vendor-licenses.txt new file mode 100644 index 0000000..f7d4112 --- /dev/null +++ b/furo-2023.05.20-vendor-licenses.txt @@ -0,0 +1,14 @@ +yarn run v1.22.19 +$ /tmpnode_modules/.bin/license-checker --summary +├─ MIT: 237 +├─ ISC: 36 +├─ BSD-2-Clause: 15 +├─ BSD-3-Clause: 5 +├─ Apache-2.0: 4 +├─ CC0-1.0: 2 +├─ Python-2.0: 1 +├─ CC-BY-4.0: 1 +├─ CC-BY-3.0: 1 +└─ (MIT AND CC-BY-3.0): 1 + +Done in 0.98s. diff --git a/furo-2023.05.20-vendor.tar.xz b/furo-2023.05.20-vendor.tar.xz new file mode 100644 index 0000000..e9379fc Binary files /dev/null and b/furo-2023.05.20-vendor.tar.xz differ diff --git a/furo-2023.05.20.tar.gz b/furo-2023.05.20.tar.gz new file mode 100644 index 0000000..c696ff2 Binary files /dev/null and b/furo-2023.05.20.tar.gz differ diff --git a/prepare_vendor.sh b/prepare_vendor.sh new file mode 100755 index 0000000..9a4b622 --- /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/python-furo.spec b/python-furo.spec new file mode 100644 index 0000000..2a6be2f --- /dev/null +++ b/python-furo.spec @@ -0,0 +1,131 @@ +%global _empty_manifest_terminate_build 0 + +Name: python-furo +Version: 2023.05.20 +Release: 1 +Summary: A clean customisable Sphinx documentation theme. + +License: MIT +URL: https://github.com/pradyunsg/furo +Source0: https://github.com/pradyunsg/furo/archive/%{version}/furo-%{version}.tar.gz +# Source1 and Source2 created with ./prepare_vendor.sh +Source1: furo-%{version}-vendor.tar.xz +Source2: furo-%{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-pygments >= 2.7 +BuildRequires: python3-myst-parser + +%global _description %{expand: +A clean customisable Sphinx documentation theme. +Furo is a Sphinx theme, which is: +- Intentionally minimal --- the most important thing is the content, not + the scaffolding around it. +- Responsive --- adapting perfectly to the available screen space, to + work on all sorts of devices. +- Customizable --- change the color palette, font families, logo and + more! +- Easy to navigate --- with carefully-designed sidebar navigation and + inter-page links. +- Good looking content --- through clear typography and well-stylized + elements. +- Good looking search --- helps readers find what they want quickly. +- Biased for smaller docsets --- intended for smaller documentation + sets, where presenting the entire hierarchy in the sidebar is not + overwhelming.} + + +%description %_description + +%package -n python3-furo +Summary: %{summary} + +%description -n python3-furo %_description + +%package help +Summary: Documentation for %{name} +# This project is MIT. 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 furo-%{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-furo +%doc README.md +%license LICENSE +%{python3_sitelib}/furo +%{python3_sitelib}/furo*.dist-info/ + +%files help +%doc html +%license LICENSE + +%changelog +* Wed Jul 12 2023 Dongxing Wang - 2023.05.20-1 +- Initial package