# sitelib for noarch packages, sitearch for others (remove the unneeded one) %{!?__python2: %global __python2 %__python} %{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} %if 0%{?fedora} %bcond_without python3 %else %bcond_with python3 %endif %global pkgname jinja2-time Name: python-jinja2-time Version: 0.2.0 Release: 1%{?dist} Summary: Jinja2 Extension for Dates and Times License: MIT URL: https://github.com/hackebrot/jinja2-time Source0: https://github.com/hackebrot/%{pkgname}/archive/%{version}.tar.gz BuildArch: noarch BuildRequires: python2-devel BuildRequires: python2-arrow BuildRequires: python2-jinja2 %if %{with python3} BuildRequires: python3-devel BuildRequires: python3-arrow BuildRequires: python3-jinja2 %endif # with python3 %description Jinja2 Extension for Dates and Times %package -n python2-%{pkgname} Summary: %{summary} %{?python_provide:%python_provide python2-%{pkgname}} %description -n python2-%{pkgname} Jinja2 Extension for Dates and Times %if %{with python3} %package -n python3-%{pkgname} Summary: %{summary} %{?python_provide:%python_provide python3-%{pkgname}} %description -n python3-%{pkgname} Jinja2 Extension for Dates and Times %endif # with python3 %prep %autosetup -n %{pkgname}-%{version} %build %{py2_build} %if %{with python3} %{py3_build} %endif # with python3 %install %{py2_install} %if %{with python3} %{py3_install} %endif # with python3 %check %{__python2} setup.py test %if %{with python3} %{__python3} setup.py test %endif %files -n python2-%{pkgname} %license LICENSE %doc *.rst %{python2_sitelib}/* %if %{with python3} %files -n python3-%{pkgname} %license LICENSE %doc *.rst %{python3_sitelib}/* %endif # with python3 %changelog * Wed Mar 7 2018 Brett Lentz - 0.2.0-1 - initial packaging