# needed for epel6
%if 0%{?rhel} && 0%{?rhel} <= 6
%{!?__python2: %global __python2 /usr/bin/python2}
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%endif
# disable tests on rhel, python-httpretty is not available
%if 0%{?rhel}
%bcond_with tests
%else
%bcond_without tests
%endif
# enable python3 on fedora
%if 0%{?fedora}
%bcond_without python3
%else
%bcond_with python3
%endif
%global srcname pyzabbix
%global commit 01280ea0197cdc11017aced688d7efc53c74e96b
Name: python-pyzabbix
Version: 0.7.3
Release: 1%{?dist}
Summary: PyZabbix is a Python module for working with the Zabbix API
# license is in README.markdown
License: LGPLv2+
URL: https://github.com/lukecyca/pyzabbix
Source0: https://github.com/lukecyca/pyzabbix/archive/%{commit}/%{srcname}-%{commit}.tar.gz#/%{srcname}-%{commit}.tar.gz
BuildArch: noarch
Requires: python-requests
BuildRequires: python-devel
%if %{with tests}
BuildRequires: python-httpretty
BuildRequires: python-nose
%endif
BuildRequires: python-requests
BuildRequires: python-setuptools
%if %{with python3}
Requires: python3-requests
BuildRequires: python3-devel
BuildRequires: python3-httpretty
BuildRequires: python3-requests
BuildRequires: python3-setuptools
%if 0%{?fedora} >= 22
BuildRequires: python3-nose
%endif
%endif
%description
%{summary}.
%if %{with python3}
%package -n python3-pyzabbix
Summary: PyZabbix is a Python module for working with the Zabbix API
License: LGPLv2
%description -n python3-pyzabbix
%{summary}.
%endif
%prep
%setup -q -n %{srcname}-%{commit}
rm -rf *.egg-info
%if %{with python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif
%build
%{__python2} setup.py build
%if %{with python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif
%install
%if %{with python3}
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
popd
%endif
%{__python2} setup.py install -O1 --skip-build --root %{buildroot}
%check
%if %{with tests}
%{__python2} setup.py nosetests
%if %{with python3}
%if 0%{?fedora} >= 22
%{__python3} setup.py nosetests
%endif
%endif
%endif
%files
%doc README.markdown examples/
%{python2_sitelib}/%{srcname}
%{python2_sitelib}/%{srcname}-%{version}-py2.?.egg-info
%if %{with python3}
%files -n python3-pyzabbix
%doc README.markdown examples/
%{python3_sitelib}/%{srcname}
%{python3_sitelib}/%{srcname}-%{version}-py3.?.egg-info
%endif
%changelog
* Fri Jul 03 2015 Piotr Popieluch <piotr1212@gmail.com> - 0.7.3-1
- Update to 0.7.3
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.7.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Thu Feb 19 2015 Piotr Popieluch <piotr1212@gmail.com> - 0.7.2-2
- Explicitly name BuildRequires: python-setuptools
- Disabled tests for EPEL
* Thu Feb 12 2015 Piotr Popieluch <piotr1212@gmail.com> - 0.7.2-1
- Initial package