Blob Blame History Raw
%global srcname graphitesend
%global sum     Easy python bindings to write to Carbon
%global desc    \
Easy python bindings to write to Carbon (Re-write of carbonclient).
%global debug_package   %{nil}

%if 0%{?fedora}
%bcond_without python3
%endif

Name:           python-%{srcname}
Version:        0.10.0
Release:        2%{?dist}
Summary:        %{sum}

License:        ASL 2.0
URL:            https://github.com/daniellawrence/%{srcname}
Source0:        https://github.com/daniellawrence/%{srcname}/archive/%{version}/%{srcname}-%{version}.tar.gz
# use setuptools instead of distutils, which didn't support all used setting.
Patch0:         %{srcname}-setup.patch
# get rid of shebang
Patch1:         %{srcname}-shebang.patch

BuildRequires:  python2-devel
BuildRequires:  python-setuptools
%if %{with python3}
BuildRequires:  python%{python3_pkgversion}-devel
BuildRequires:  python%{python3_pkgversion}-setuptools
%endif

%description
%{desc}


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

Requires:       python2-gevent

%description -n python2-%{srcname}

This is the package with python2 support.
%{desc}


%if %{with python3}
%package -n python%{python3_pkgversion}-%{srcname}
Summary:        %{sum}
%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}}

Requires:       python%{python3_pkgversion}-gevent

%description -n python%{python3_pkgversion}-%{srcname}

This is the package with python%{python3_pkgversion} support.
%{desc}
%endif


%prep
%autosetup -n %{srcname}-%{version} -p1

%build
%py2_build

%if %{with python3}
%py3_build
%endif


%install
%py2_install

%if %{with python3}
# Delete the Python 2 executable(s) so that the Python 3
# version(s) can take their place afterwards.
rm %{buildroot}%{_bindir}/*
%py3_install
%endif


%files -n python2-%{srcname}
%license LICENSE.txt
%doc CHANGELOG README.md
%if %{without python3}
%{_bindir}/graphitesend
%endif
%{python2_sitelib}/*

%if %{with python3}
%files -n python%{python3_pkgversion}-%{srcname}
%license LICENSE.txt
%doc CHANGELOG README.md
%{_bindir}/graphitesend
%{python3_sitelib}/*
%endif


%changelog
* Wed Sep 13 2017 Iryna Shcherbina <ishcherb@redhat.com> - 0.10.0-2
- Fix Python 3 dependency from python2-graphitesend

* Fri Sep  8 2017 Jakub Jedelsky <jakub.jedelsky@gmail.com> - 0.10.0-1
- Initial package