Initial import.

This commit is contained in:
Jerry James 2022-09-06 16:24:05 -06:00
commit f563befe88
5 changed files with 253 additions and 0 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
/furo-*-vendor.tar.xz
/furo-*.tar.gz

View file

@ -0,0 +1,13 @@
yarn run v1.22.17
$ /tmpnode_modules/.bin/license-checker --summary
├─ MIT: 220
├─ ISC: 36
├─ BSD-2-Clause: 15
├─ BSD-3-Clause: 5
├─ Apache-2.0: 4
├─ CC0-1.0: 2
├─ CC-BY-4.0: 1
├─ CC-BY-3.0: 1
└─ (MIT AND CC-BY-3.0): 1
Done in 0.78s.

102
prepare_vendor.sh Executable file
View file

@ -0,0 +1,102 @@
#!/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"
rm package-lock.json
sed -i '/sass-loader/a\ "sass": "^1.54.5",' package.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

134
python-furo.spec Normal file
View file

@ -0,0 +1,134 @@
Name: python-furo
Version: 2022.06.21
Release: 1%{?dist}
Summary: Clean customizable Sphinx documentation theme
License: MIT
URL: https://pradyunsg.me/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: make
BuildRequires: nodejs-devel
BuildRequires: npm
BuildRequires: python-sphinx-doc
BuildRequires: python3-devel
BuildRequires: python3-docs
BuildRequires: %{py3_dist beautifulsoup4}
BuildRequires: %{py3_dist myst-parser}
BuildRequires: %{py3_dist nodeenv}
BuildRequires: %{py3_dist pip}
BuildRequires: %{py3_dist pygments}
BuildRequires: %{py3_dist sphinx}
BuildRequires: %{py3_dist sphinx-basic-ng}
BuildRequires: %{py3_dist sphinx-copybutton}
BuildRequires: %{py3_dist sphinx-design}
BuildRequires: %{py3_dist sphinx-inline-tabs}
BuildRequires: %{py3_dist sphinx-theme-builder}
BuildRequires: %{py3_dist wheel}
BuildRequires: yarnpkg
%global _description %{expand:
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: Clean customizable Sphinx documentation theme
%description -n python3-furo %_description
%package doc
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 doc
Documentation for %{name}.
%prep
%autosetup -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
# 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
# sass-loader needs a sass implementation
sed -i '/sass-loader/a\ "sass": "^1.54.5",' package.json
# 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_wheel
%install
%pyproject_install
%pyproject_save_files furo
# Build documentation
PYTHONPATH=%{buildroot}%{python3_sitelib} sphinx-build -b html docs html
rm -rf html/{.buildinfo,.doctrees}
%check
# There aren't any tests. When there are, do this:
#%%pytest
%pyproject_check_import
%files -n python3-furo -f %{pyproject_files}
%doc README.md
%license LICENSE
%files doc
%doc html
%license LICENSE
%changelog
* Thu Aug 25 2022 Jerry James <loganjerry@gmail.com> - 2022.06.21-1
- Initial RPM

2
sources Normal file
View file

@ -0,0 +1,2 @@
SHA512 (furo-2022.06.21-vendor.tar.xz) = bb65697c119ecfb9b9dd90020b17fa8a9b1c5178a4e2f9fc247c6959c1a5a5705cb0cc7dcced7b6d8d603aab61729b206d14b3801c5e5d03d87942efe1c31276
SHA512 (furo-2022.06.21.tar.gz) = 6142408335baa7155eb9632c90e46c5677941a551e3b66c99c004b83ddda265e16c53bb6a1b03c712af154c293e267ff39f32cbe48bc4a2b15135f6bb4f52981