Blob Blame History Raw
%if 0%{?fedora}
%global with_python3 1
%endif

%global pypi_name sphinxcontrib-seqdiag

Name:           python-%{pypi_name}
Version:        0.8.4
Release:        5%{?dist}
Summary:        Sphinx "seqdiag" extension

License:        BSD
URL:            http://github.com/blockdiag/sphinxcontrib-seqdiag
Source0:        https://pypi.python.org/packages/source/s/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
BuildArch:      noarch
 
%package -n python2-%{pypi_name}
Summary:        Sphinx "seqdiag" extension
%{?python_provide:%python_provide python2-%{pypi_name}}

BuildRequires:  python2-devel
BuildRequires:  python-setuptools

Requires:       python-blockdiag >= 1.5.0
Requires:       python-seqdiag >= 0.9.3
Requires:       python-sphinx >= 0.6

%description -n python2-%{pypi_name}
A sphinx extension for embedding sequence diagram using seqdiag_.

%if 0%{?with_python3}
%package -n python3-%{pypi_name}
Summary:        Sphinx "seqdiag" extension

BuildRequires:  python3-setuptools
BuildRequires:  python3-devel

Requires:       python3-blockdiag >= 1.5.0
Requires:       python3-seqdiag >= 0.9.3
Requires:       python3-sphinx >= 0.6

%description -n python3-%{pypi_name}
A sphinx extension for embedding sequence diagram using seqdiag_.
%endif

%description
A sphinx extension for embedding sequence diagram using seqdiag_.

%prep
%setup -qc
mv %{pypi_name}-%{version} python2
pushd python2
# copy LICENSE etc. to top level dir
cp -a LICENSE ..
cp -a README.rst ..
popd

%if 0%{?with_python3}
cp -a python2 python3
%endif

%build
pushd python2
%{__python2} setup.py build
popd

%if 0%{?with_python3}
pushd python3
%{__python3} setup.py build
popd
%endif # with_python3

%install
pushd python2
%{__python2} setup.py install --skip-build --root %{buildroot}
popd

%if 0%{?with_python3}
pushd python3
%{__python3} setup.py install --skip-build --root %{buildroot}
popd
%endif

%files -n python2-%{pypi_name}
%doc README.rst
%license LICENSE
%{python2_sitelib}/sphinxcontrib/*.py
%{python2_sitelib}/sphinxcontrib/*.pyc
%{python2_sitelib}/sphinxcontrib/*.pyo
%{python2_sitelib}/*.egg-info
%{python2_sitelib}/*-nspkg.pth
%exclude %{python2_sitelib}/tests/

%if 0%{?with_python3}
%files -n python3-%{pypi_name}
%doc README.rst
%license LICENSE
%{python3_sitelib}/sphinxcontrib/*.py
%{python3_sitelib}/sphinxcontrib/__pycache__/*.pyc
%{python3_sitelib}/sphinxcontrib/__pycache__/*.pyo
%{python3_sitelib}/*.egg-info
%{python3_sitelib}/*-nspkg.pth
%exclude %{python3_sitelib}/tests/
%endif

%changelog
* Thu Aug 27 2015 Javier Peña <jpena@redhat.com> - 0.8.4-5
- Drop python_sitelib fallback macro
* Thu Aug 27 2015 Javier Peña <jpena@redhat.com> - 0.8.4-4
- Comply with updated Python packaging guidelines
* Thu Aug 27 2015 Javier Peña <jpena@redhat.com> - 0.8.4-3
- Fixed python3 macro
- Improved file listing
* Mon Jul 13 2015 jpena <jpena@redhat.com> - 0.8.4-2
- Added python3 build.
* Thu Jul 09 2015 jpena <jpena@redhat.com> - 0.8.4-1
- Initial package.