%if 0%{?fedora} || 0%{?rhel} >= 7
%bcond_without python3
%else  # 0#{?fedora} || 0#{?rhel} >= 7
%bcond_with python3
%endif # 0#{?fedora} || 0#{?rhel} >= 7

# this is only turned on during transitional periods
%{?python3_next_pkgversion: %global with_python3_next 1}

%global sum Python bindings for xapps


Name:           python-xapp
Version:        1.0.1
Release:        7%{?dist}
Summary:        %{sum}

License:        LGPLv2
URL:            https://github.com/linuxmint/%{name}
Source0:        %{url}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz

Patch0:		%{url}/pull/5.patch#/%{name}-1.0.1-setup_py_ver.patch

BuildArch:      noarch

%description
%{sum}.


%package -n python2-xapp
Summary:       %{sum}

BuildRequires: python2-devel

%if 0%{?fedora} || 0%{?rhel} >= 8
BuildRequires: python2-setuptools
Requires:      python2-psutil
%else  # 0#{?fedora} || 0#{?rhel} >= 8
BuildRequires: python-setuptools
Requires:      python-psutil
%endif # 0#{?fedora} || 0#{?rhel} >= 8

%{?python_provide:%python_provide python2-xapp}

%description -n python2-xapp
%{sum}.


%if %{with python3}
%package -n python%{python3_pkgversion}-xapp
Summary:       %{sum}

BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-setuptools

Requires:      python%{python3_pkgversion}-psutil

%{?python_provide:%python_provide python%{python3_pkgversion}-xapp}

%if ("python%{python3_pkgversion}-xapp" != "python3-xapp") && !0%{?with_python3_next}
Provides:      python3-xapp = %{version}-%{release}
%endif

%description -n python%{python3_pkgversion}-xapp
%{sum}.
%endif # with python3


%if 0%{?with_python3_next}
%package -n python%{python3_next_pkgversion}-xapp
Summary:       %{sum}

BuildRequires: python%{python3_next_pkgversion}-devel
BuildRequires: python%{python3_next_pkgversion}-setuptools

Requires:      python%{python3_next_pkgversion}-psutil

%{?python_provide:%python_provide python%{python3_next_pkgversion}-xapp}

%if ("python%{python3_next_pkgversion}-xapp" != "python3-xapp") && 0%{?with_python3_next}
Provides:      python3-xapp = %{version}-%{release}
%endif

%description -n python%{python3_next_pkgversion}-xapp
%{sum}.
%endif # with_python3_next


%prep
%autosetup -p 1


%build
%py2_build
%if %{with python3}
%py3_build
%endif # with python3
%if 0%{?with_python3_next}
%py3_next_build
%endif # with_python3_next


%install
%py2_install
%if %{with python3}
%py3_install
%endif # with python3
%if 0%{?with_python3_next}
%py3_next_install
%endif # with_python3_next


%files -n python2-xapp
%license COPYING debian/copyright
%doc AUTHORS PKG-INFO README TODO debian/changelog
%{python2_sitelib}/xapp
%{python2_sitelib}/python_xapp-%{version}-py%{python2_version}.egg-info


%if %{with python3}
%files -n python%{python3_pkgversion}-xapp
%license COPYING debian/copyright
%doc AUTHORS PKG-INFO README TODO debian/changelog
%{python3_sitelib}/xapp
%{python3_sitelib}/python_xapp-%{version}-py%{python3_version}.egg-info
%endif # with python3


%if 0%{?with_python3_next}
%files -n python%{python3_next_pkgversion}-xapp
%license COPYING debian/copyright
%doc AUTHORS PKG-INFO README TODO debian/changelog
%{python3_next_sitelib}/xapp
%{python3_next_sitelib}/python_xapp-%{version}-py%{python3_next_version}.egg-info
%endif # with_python3_next


%changelog
* Thu Nov 16 2017 Björn Esser <besser82@fedoraproject.org> - 1.0.1-7
- Use unified Provides for EPEL7

* Thu Nov 16 2017 Björn Esser <besser82@fedoraproject.org> - 1.0.1-6
- Use unified macros for Python 3

* Thu Aug 31 2017 Björn Esser <besser82@fedoraproject.org> - 1.0.1-5
- Build a Python3 compat pkg on RHEL7

* Tue Aug 29 2017 Björn Esser <besser82@fedoraproject.org> - 1.0.1-4
- Fix for EPEL

* Tue Aug 29 2017 Björn Esser <besser82@fedoraproject.org> - 1.0.1-3
- Conditionalize Python3 for EPEL

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Tue Jun 13 2017 Björn Esser <besser82@fedoraproject.org> - 1.0.1-1
- Update to 1.0.1 release (rhbz#1460408)

* Mon May 01 2017 Leigh Scott <leigh123linux@gmail.com> - 1.0.0-1
- Initial rpm-release (rhbz#1448559)
