Blob Blame History Raw
%if 0%{?fedora} >= 12 || 0%{?rhel} >= 8
%global with_py3 1
%endif

%global pkgname sphinx_rtd_theme

Name:           python-%{pkgname}
Version:        0.1.6
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
BuildArch:      noarch

BuildRequires:  python-devel
BuildRequires:  python-setuptools

%if 0%{?with_py3}
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
%endif

Requires:       fontawesome-fonts

%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}
Summary:        Sphinx theme for readthedocs.org
Requires:       fontawesome-fonts

%description -n python3-%{pkgname}
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.
%endif

%prep
%setup -q -c

# Prepare for python3 build
cp -a %{pkgname}-%{version} python3-%{pkgname}-%{version}

%build
# Python 2 build
pushd %{pkgname}-%{version}
%{__python2} setup.py build
popd

%if 0%{?with_py3}
# Python 3 build
pushd python3-%{pkgname}-%{version}
%{__python3} setup.py build
popd
%endif

%install
# Python 2 install
pushd %{pkgname}-%{version}
%{__python2} setup.py install -O1 --skip-build --root %{buildroot}
popd

# Don't use the bundled font
rm %{buildroot}/%{python2_sitelib}/%{pkgname}/static/fonts/*.ttf
ln -s %{_datadir}/fonts/fontawesome/fontawesome-webfont.ttf \
      %{buildroot}/%{python2_sitelib}/%{pkgname}/static/fonts/

%if 0%{?with_py3}
# Python 3 install
pushd python3-%{pkgname}-%{version}
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
popd

# Don't use the bundled font
rm %{buildroot}/%{python3_sitelib}/%{pkgname}/static/fonts/*.ttf
ln -s %{_datadir}/fonts/fontawesome/fontawesome-webfont.ttf \
      %{buildroot}/%{python3_sitelib}/%{pkgname}/static/fonts/
%endif
 
%files
%doc %{pkgname}-%{version}/LICENSE %{pkgname}-%{version}/README.rst
%{python2_sitelib}/%{pkgname}*
 
%if 0%{?with_py3}
%files -n python3-%{pkgname}
%doc %{pkgname}-%{version}/LICENSE %{pkgname}-%{version}/README.rst
%{python3_sitelib}/%{pkgname}*
%endif

%changelog
* Thu Jul  3 2014 Jerry James <loganjerry@gmail.com> - 0.1.6-1
- Initial RPM