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
1 changed files with 61 additions and 46 deletions

View File

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