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

%global srcname statsd

Name:       python-%{srcname}
Version:    3.2.1
Release:    5%{?dist}
Summary:    A Python statsd client

License:    MIT
URL:        https://github.com/jsocol/pystatsd
Source0:    https://pypi.python.org/packages/source/s/%{srcname}/%{srcname}-%{version}.tar.gz
# Apply https://github.com/jsocol/pystatsd/pull/88
Patch0:     0001-Fix-sphinx-extension-conflict.patch

BuildArch:  noarch

BuildRequires:  python2-devel
BuildRequires:  python-mock
BuildRequires:  python-nose
%if 0%{?with_python3}
BuildRequires:  python3-devel
BuildRequires:  python3-mock
BuildRequires:  python3-nose
%endif # if with_python3

%description
A python client for the statsd daemon.

%package -n python2-%{srcname}
Summary: %{summary}
%{?python_provide:%python_provide python2-%{srcname}}

%description -n python2-%{srcname}
A python client for the statsd daemon.

%if 0%{?with_python3}
%package -n python3-%{srcname}
Summary: %{summary}
%{?python_provide:%python_provide python3-%{srcname}}

%description -n python3-%{srcname}
A python client for the statsd daemon.
%endif

%package doc
Summary: Documentation of the Python client for the statsd daemon
BuildRequires:  python-sphinx

%description doc
Documentation of the Python client for the statsd daemon.

%prep
%autosetup -n %{srcname}-%{version} -p1
# Remove bundled egg-info
rm -rf %{srcname}.egg-info
# Let RPM handle the dependencies
rm -f requirements.txt

%build
%py2_build
%if 0%{?with_python3}
%py3_build
%endif

## generate html docs
sphinx-build docs html
rm -rf html/.{doctrees,buildinfo}

%install
%py2_install
%if 0%{?with_python3}
%py3_install
%endif

%check
%{__python2} setup.py test
%if 0%{?with_python3}
%{__python3} setup.py test
%endif

%files -n python2-%{srcname}
%license LICENSE
%doc AUTHORS README.rst
%{python2_sitelib}/*

%if 0%{?with_python3}
%files -n python3-%{srcname}
%license LICENSE
%doc AUTHORS README.rst
%{python3_sitelib}/*
%endif

%files doc
%license LICENSE
%doc html

%changelog
* Mon Jan 02 2017 Tristan de Cacqueray <tdecacqu@redhat.com> - 3.2.1-5
- Fix sphinx-build error

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Fri Dec 18 2015 Paul Belanger <pabelanger@redhat.com> - 3.2.1-2
- Ensure python3-statsd only exists when with_python3 defined
- Add python3 testing dependencies
- Run tests under python3

* Fri Dec 18 2015 Paul Belanger <pabelanger@redhat.com> - 3.2.1-1
- New upstream version - 3.2.1
- Add support for both python2 and python3.

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.1.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Tue Apr 28 2015 Tristan de Cacqueray <tdecacqu@redhat.com> - 2.1.2-2.fc21
- Fixed fedora-review warnings

* Thu Apr 23 2015 Tristan de Cacqueray <tdecacqu@redhat.com> - 2.1.2-1.fc21
- Initial packaging