%global srcname neaty

%if ( 0%{?rhel} && 0%{?rhel} == 6 ) || ( 0%{?centos} && 0%{?centos} == 6 )
%bcond_with python3
%bcond_without python2
%endif

%if ( 0%{?rhel} && 0%{?rhel} == 7 ) || ( 0%{?centos} && 0%{?centos} == 7 )
%bcond_without python3
%bcond_without python2
%endif

%if ( 0%{?rhel} && 0%{?rhel} > 7 ) || ( 0%{?centos} && 0%{?centos} > 7 )
%bcond_without python3
%bcond_with python2
%endif

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

%if %{with python2}
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%{!?pyver: %global pyver %(%{__python} -c "import sys ; print sys.version[:3]")}
%global mkit_safever %(sh -c 'echo -n "0.0.16" | tr -c "a-zA-Z0-9._" _')
%endif

Name:           python-neaty
Version:        0.0.16
Release:        1%{?dist}
Summary:        neaty - Neaty logger
URL:            https://gitlab.com/vornet/python/python-neaty
License:        LGPLv2
Source0:        %{name}-%{version}.tar.gz
BuildArch:      noarch
BuildRequires:  make

%description
Neaty logger


%if %{with python2}
%package -n python2-%{srcname}
Summary:        %{summary}
BuildRequires:  python2-devel
%description -n python2-%{srcname}
Neaty logger
%endif


%if %{with python3}
%package -n python3-%{srcname}
Summary:        %{summary}
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
%description -n python3-%{srcname}
Neaty logger
%endif


%prep
%setup -q


%build
make %{?_smp_mflags} PREFIX=/usr build_pystuff
%if %{with python2}
%{__python} setup.py build
%endif
%if %{with python3}
%py3_build
%endif


%install
%if %{with python2}
%{__python} setup.py install \
        -O1 \
        --skip-build \
        --root $RPM_BUILD_ROOT \
        --install-data=%{_datadir}
%endif
%if %{with python3}
%py3_install
%endif


%if %{with python2}
%files -n python2-%{srcname}
%{python_sitelib}/%{srcname}-%{mkit_safever}-py%{pyver}.egg-info
%{python_sitelib}/%{srcname}
%endif


%if %{with python3}
%files -n python3-%{srcname}
%{python3_sitelib}/%{srcname}-*.egg-info
%{python3_sitelib}/%{srcname}/
%endif


%changelog

# specfile built with MKit 0.0.53