Comply with latest python packaging guidelines.

This commit is contained in:
Jerry James 2016-02-01 17:25:03 -07:00
parent d5cd5f2ba8
commit e720b42f5e

View File

@ -2,16 +2,16 @@
%global with_py3 1
%endif
%global pkgname sphinx_rtd_theme
%global srcname sphinx_rtd_theme
Name: python-%{pkgname}
Name: python-%{srcname}
Version: 0.1.9
Release: 1%{?dist}
Summary: Sphinx theme for readthedocs.org
License: MIT
URL: https://github.com/snide/sphinx_rtd_theme
Source0: https://pypi.python.org/packages/source/s/%{pkgname}/%{pkgname}-%{version}.tar.gz
Source0: https://pypi.python.org/packages/source/s/%{srcname}/%{srcname}-%{version}.tar.gz
BuildArch: noarch
BuildRequires: python-devel
@ -22,26 +22,38 @@ BuildRequires: python3-devel
BuildRequires: python3-setuptools
%endif
# fontawesome-web doest not provide font(fontawesome-web) rhbz#1282587
Requires: fontawesome-fonts-web
Requires: font(fontawesome)
Requires: font(lato)
%description
This is a prototype mobile-friendly sphinx theme for readthedocs.org.
It's currently in development and includes some rtd variable checks that
can be ignored if you're just trying to use it on your project outside
of that site.
%if 0%{?with_py3}
%package -n python3-%{pkgname}
%package -n python2-%{srcname}
Summary: Sphinx theme for readthedocs.org
# fontawesome-web doest not provide font(fontawesome-web) rhbz#1282587
# fontawesome-web does not provide font(fontawesome-web) rhbz#1282587
Requires: fontawesome-fonts-web
Requires: font(fontawesome)
Requires: font(lato)
%description -n python3-%{pkgname}
%{?python_provide:%python_provide python2-%{srcname}}
%description -n python2-%{srcname}
This is a prototype mobile-friendly sphinx theme for readthedocs.org.
It's currently in development and includes some rtd variable checks that
can be ignored if you're just trying to use it on your project outside
of that site.
%if 0%{?with_py3}
%package -n python3-%{srcname}
Summary: Sphinx theme for readthedocs.org
# fontawesome-web does not provide font(fontawesome-web) rhbz#1282587
Requires: fontawesome-fonts-web
Requires: font(fontawesome)
Requires: font(lato)
%{?python_provide:%python_provide python3-%{srcname}}
%description -n python3-%{srcname}
This is a prototype mobile-friendly sphinx theme for readthedocs.org.
It's currently in development and includes some rtd variable checks that
can be ignored if you're just trying to use it on your project outside
@ -52,77 +64,80 @@ of that site.
%setup -q -c
# Prepare for python3 build
cp -a %{pkgname}-%{version} python3-%{pkgname}-%{version}
cp -a %{srcname}-%{version} python3-%{srcname}-%{version}
%build
# Python 2 build
pushd %{pkgname}-%{version}
%{__python2} setup.py build
pushd %{srcname}-%{version}
%py2_build
popd
%if 0%{?with_py3}
# Python 3 build
pushd python3-%{pkgname}-%{version}
%{__python3} setup.py build
pushd python3-%{srcname}-%{version}
%py3_build
popd
%endif
%install
# Python 2 install
pushd %{pkgname}-%{version}
%{__python2} setup.py install -O1 --skip-build --root %{buildroot}
pushd %{srcname}-%{version}
%py2_install
popd
# Don't use the bundled fonts
rm %{buildroot}/%{python2_sitelib}/%{pkgname}/static/fonts/*.{svg,woff}
rm %{buildroot}/%{python2_sitelib}/%{pkgname}/static/fonts/fontawesome*.ttf
rm %{buildroot}/%{python2_sitelib}/%{pkgname}/static/fonts/Lato*.ttf
rm %{buildroot}/%{python2_sitelib}/%{srcname}/static/fonts/*.{svg,woff}
rm %{buildroot}/%{python2_sitelib}/%{srcname}/static/fonts/fontawesome*.ttf
rm %{buildroot}/%{python2_sitelib}/%{srcname}/static/fonts/Lato*.ttf
ln -s %{_datadir}/fonts/fontawesome/fontawesome-webfont.svg \
%{buildroot}/%{python2_sitelib}/%{pkgname}/static/fonts/
%{buildroot}/%{python2_sitelib}/%{srcname}/static/fonts/
ln -s %{_datadir}/fonts/fontawesome/fontawesome-webfont.ttf \
%{buildroot}/%{python2_sitelib}/%{pkgname}/static/fonts/
%{buildroot}/%{python2_sitelib}/%{srcname}/static/fonts/
ln -s %{_datadir}/fonts/fontawesome/fontawesome-webfont.woff \
%{buildroot}/%{python2_sitelib}/%{pkgname}/static/fonts/
%{buildroot}/%{python2_sitelib}/%{srcname}/static/fonts/
ln -s %{_datadir}/fonts/lato/Lato-Bold.ttf \
%{buildroot}/%{python2_sitelib}/%{pkgname}/static/fonts/
%{buildroot}/%{python2_sitelib}/%{srcname}/static/fonts/
ln -s %{_datadir}/fonts/lato/Lato-Regular.ttf \
%{buildroot}/%{python2_sitelib}/%{pkgname}/static/fonts/
%{buildroot}/%{python2_sitelib}/%{srcname}/static/fonts/
%if 0%{?with_py3}
# Python 3 install
pushd python3-%{pkgname}-%{version}
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
pushd python3-%{srcname}-%{version}
%py3_install
popd
# Don't use the bundled fonte
rm %{buildroot}/%{python3_sitelib}/%{pkgname}/static/fonts/*.{svg,woff}
rm %{buildroot}/%{python3_sitelib}/%{pkgname}/static/fonts/fontawesome*.ttf
rm %{buildroot}/%{python3_sitelib}/%{pkgname}/static/fonts/Lato*.ttf
# Don't use the bundled fonts
rm %{buildroot}/%{python3_sitelib}/%{srcname}/static/fonts/*.{svg,woff}
rm %{buildroot}/%{python3_sitelib}/%{srcname}/static/fonts/fontawesome*.ttf
rm %{buildroot}/%{python3_sitelib}/%{srcname}/static/fonts/Lato*.ttf
ln -s %{_datadir}/fonts/fontawesome/fontawesome-webfont.svg \
%{buildroot}/%{python3_sitelib}/%{pkgname}/static/fonts/
%{buildroot}/%{python3_sitelib}/%{srcname}/static/fonts/
ln -s %{_datadir}/fonts/fontawesome/fontawesome-webfont.ttf \
%{buildroot}/%{python3_sitelib}/%{pkgname}/static/fonts/
%{buildroot}/%{python3_sitelib}/%{srcname}/static/fonts/
ln -s %{_datadir}/fonts/fontawesome/fontawesome-webfont.woff \
%{buildroot}/%{python3_sitelib}/%{pkgname}/static/fonts/
%{buildroot}/%{python3_sitelib}/%{srcname}/static/fonts/
ln -s %{_datadir}/fonts/lato/Lato-Bold.ttf \
%{buildroot}/%{python3_sitelib}/%{pkgname}/static/fonts/
%{buildroot}/%{python3_sitelib}/%{srcname}/static/fonts/
ln -s %{_datadir}/fonts/lato/Lato-Regular.ttf \
%{buildroot}/%{python3_sitelib}/%{pkgname}/static/fonts/
%{buildroot}/%{python3_sitelib}/%{srcname}/static/fonts/
%endif
%files
%doc %{pkgname}-%{version}/README.rst
%license %{pkgname}-%{version}/LICENSE
%{python2_sitelib}/%{pkgname}*
%files -n python2-%{srcname}
%doc %{srcname}-%{version}/README.rst
%license %{srcname}-%{version}/LICENSE
%{python2_sitelib}/%{srcname}*
%if 0%{?with_py3}
%files -n python3-%{pkgname}
%doc python3-%{pkgname}-%{version}/README.rst
%license python3-%{pkgname}-%{version}/LICENSE
%{python3_sitelib}/%{pkgname}*
%files -n python3-%{srcname}
%doc python3-%{srcname}-%{version}/README.rst
%license python3-%{srcname}-%{version}/LICENSE
%{python3_sitelib}/%{srcname}*
%endif
%changelog
* Mon Feb 1 2016 Jerry James <loganjerry@gmail.com> - 0.1.9-1
- Comply with latest python packaging guidelines
* Tue Nov 24 2015 Jerry James <loganjerry@gmail.com> - 0.1.9-1
- New upstream version