Blob Blame History Raw
%global pypi_name django-model-utils
# Python 3 only for Fedora for now.
%if 0%{?fedora}
%global with_python3 1
%endif

# python2 prefix not always exists in EPEL7
%if 0%{?rhel} && 0%{?rhel} <= 7
%global with_python_old_prefix 1
%endif

Name:           python-%{pypi_name}
Version:        2.5.2
Release:        1%{?dist}
Summary:        Django model mixins and utilities

License:        BSD
URL:            https://github.com/carljm/django-model-utils
Source0:        https://files.pythonhosted.org/packages/source/%(n=%{pypi_name}; echo ${n:0:1})/%{pypi_name}/%{pypi_name}-%{version}.tar.gz

BuildArch:      noarch

BuildRequires:  python2-devel
%if 0%{?with_python_old_prefix}
BuildRequires:  python-django
BuildRequires:  python-setuptools
%else
BuildRequires:  python2-django
BuildRequires:  python2-setuptools
%endif
%if 0%{?with_python3}
BuildRequires:  python3-django
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
%endif # if with_python3

%description
%{summary}.

%package -n python2-%{pypi_name}
Summary:        %{summary}
%{?python_provide:%python_provide python2-%{pypi_name}}
%if 0%{?with_python_old_prefix}
Requires:  python-django
%else
Requires:  python2-django
%endif
%description -n python2-%{pypi_name}
%{summary}.

%if 0%{?with_python3}
%package -n python3-%{pypi_name}
Summary:        %{summary}
%{?python_provide:%python_provide python3-%{pypi_name}}
Requires:  python3-django
%description -n python3-%{pypi_name}
%{summary}.
%endif # if with_python3

%prep
%setup -q -n %{pypi_name}-%{version}

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

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

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

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

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

%changelog
* Wed Aug 10 2016 Germano Massullo <germano.massullo@gmail.com> - 2.5.2-1
- First commit on Fedora's Git