8f08240
%if 0%{?fedora} || 0%{?rhel} >= 8
8f08240
%global with_python3 1
8f08240
%endif
8f08240
8f08240
%global srcname pybtex-docutils
8f08240
8f08240
Name:           python-%{srcname}
8f08240
Version:        0.2.1
8f08240
Release:        2%{?dist}
8f08240
Summary:        Docutils backend for pybtex
8f08240
8f08240
License:        MIT
8f08240
URL:            https://github.com/mcmtroffaes/%{srcname}
8f08240
Source0:        https://pypi.python.org/packages/source/p/%{srcname}/%{srcname}-%{version}.tar.gz
8f08240
BuildArch:      noarch
8f08240
8f08240
BuildRequires:  python2-devel
8f08240
BuildRequires:  python-docutils
8f08240
BuildRequires:  python2-nose
8f08240
BuildRequires:  python2-nose-cov
8f08240
BuildRequires:  python2-pybtex
8f08240
BuildRequires:  python2-setuptools
8f08240
BuildRequires:  python2-six
8f08240
BuildRequires:  python2-sphinx
8f08240
8f08240
%if 0%{?with_python3}
8f08240
BuildRequires:  python3-devel
8f08240
BuildRequires:  python3-docutils
8f08240
BuildRequires:  python3-nose
8f08240
BuildRequires:  python3-nose-cov
8f08240
BuildRequires:  python3-pybtex
8f08240
BuildRequires:  python3-setuptools
8f08240
BuildRequires:  python3-six
8f08240
BuildRequires:  python3-sphinx
8f08240
%endif
8f08240
8f08240
%global common_desc \
8f08240
This package contains a docutils backend for pybtex, a BibTeX-compatible\
8f08240
bibliography processor written in Python.  Bibliographic references in\
8f08240
BibTeX format (or any other format supported by pybtex) can be inserted\
8f08240
into python documentation to be rendered by docutils.
8f08240
8f08240
%description
8f08240
%common_desc
8f08240
8f08240
%package -n python2-%{srcname}
8f08240
Summary:        Docutils backend for pybtex
8f08240
Requires:       python-docutils
8f08240
Requires:       python2-pybtex
8f08240
Requires:       python2-six
8f08240
8f08240
Provides:       bundled(jquery)
8f08240
Provides:       bundled(js-underscore)
8f08240
%{?python_provide:%python_provide python2-%{srcname}}
8f08240
8f08240
%description -n python2-%{srcname}
8f08240
%common_desc
8f08240
8f08240
%if 0%{?with_python3}
8f08240
%package -n python3-%{srcname}
8f08240
Summary:        Docutils backend for pybtex
8f08240
Requires:       python3-docutils
8f08240
Requires:       python3-pybtex
8f08240
Requires:       python3-six
8f08240
8f08240
Provides:       bundled(jquery)
8f08240
Provides:       bundled(js-underscore)
8f08240
%{?python_provide:%python_provide python3-%{srcname}}
8f08240
8f08240
%description -n python3-%{srcname}
8f08240
%common_desc
8f08240
%endif
8f08240
8f08240
%prep
8f08240
%setup -q -c
8f08240
8f08240
# Use the new sphinx default theme
8f08240
sed -i "s/'default'/'alabaster'/" %{srcname}-%{version}/doc/conf.py
8f08240
8f08240
# Prepare for python3 build
8f08240
cp -a %{srcname}-%{version} python3-%{srcname}-%{version}
8f08240
8f08240
# Fix doc building with python 3
8f08240
sed -i 's/"rb"/"rt"/' python3-%{srcname}-%{version}/doc/conf.py
8f08240
8f08240
%build
8f08240
# Python 2 build
8f08240
pushd %{srcname}-%{version}
8f08240
%py2_build
8f08240
PYTHONPATH=$PWD make -C doc html
8f08240
popd
8f08240
8f08240
%if 0%{?with_python3}
8f08240
# Python 3 build
8f08240
pushd python3-%{srcname}-%{version}
8f08240
%py3_build
8f08240
PYTHONPATH=$PWD make -C doc html SPHINXBUILD=%{_bindir}/sphinx-build-%{python3_version}
8f08240
popd
8f08240
%endif
8f08240
8f08240
%install
8f08240
# Python 2 install
8f08240
pushd %{srcname}-%{version}
8f08240
%py2_install
8f08240
popd
8f08240
8f08240
%if 0%{?with_python3}
8f08240
# Python 3 install
8f08240
pushd python3-%{srcname}-%{version}
8f08240
%py3_install
8f08240
popd
8f08240
%endif
8f08240
8f08240
%check
8f08240
# Test the python 2 build
8f08240
pushd %{srcname}-%{version}
8f08240
PYTHONPATH=$PWD nosetests-%{python2_version} -v
8f08240
popd
8f08240
8f08240
%if 0%{?with_python3}
8f08240
# Python 3 install
8f08240
pushd python3-%{srcname}-%{version}
8f08240
PYTHONPATH=$PWD nosetests-%{python3_version} -v
8f08240
popd
8f08240
%endif
8f08240
8f08240
%files -n python2-%{srcname}
8f08240
%doc %{srcname}-%{version}/doc/_build/html/*
8f08240
%license %{srcname}-%{version}/LICENSE.rst
8f08240
%{python2_sitelib}/pybtex_docutils*
8f08240
8f08240
%if 0%{?with_python3}
8f08240
%files -n python3-%{srcname}
8f08240
%doc python3-%{srcname}-%{version}/doc/_build/html/*
8f08240
%license python3-%{srcname}-%{version}/LICENSE.rst
8f08240
%{python3_sitelib}/pybtex_docutils*
8f08240
%{python3_sitelib}/__pycache__/pybtex_docutils*
8f08240
%endif
8f08240
8f08240
%changelog
8f08240
* Wed Mar  2 2016 Jerry James <loganjerry@gmail.com> - 0.2.1-2
8f08240
- Expand package description
8f08240
- Fix sphinx and noseutils invocations for python 3
8f08240
- Do not convert license file to HTML
8f08240
8f08240
* Thu Feb 25 2016 Jerry James <loganjerry@gmail.com> - 0.2.1-1
8f08240
- Initial RPM