# 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 cookiecutter Name: python-cookiecutter Version: 1.6.0 Release: 1%{?dist} Summary: CLI utility to create projects from templates License: BSD URL: https://github.com/audreyr/cookiecutter Source0: https://github.com/audreyr/%{pkgname}/archive/%{version}.tar.gz BuildArch: noarch BuildRequires: python2-devel # doc deps BuildRequires: python2-sphinx BuildRequires: python2-click BuildRequires: python2-whichcraft BuildRequires: python2-binaryornot BuildRequires: python2-poyo BuildRequires: python2-jinja2-time # testing deps BuildRequires: python2-pytest BuildRequires: python2-pytest-cov BuildRequires: python2-pytest-mock BuildRequires: python2-pytest-catchlog BuildRequires: python2-freezegun BuildRequires: python2-jinja2 BuildRequires: python2-future BuildRequires: python2-arrow %if %{with python3} BuildRequires: python3-devel BuildRequires: python3-sphinx BuildRequires: python3-click BuildRequires: python3-whichcraft BuildRequires: python3-binaryornot BuildRequires: python3-poyo BuildRequires: python3-jinja2-time BuildRequires: python3-future BuildRequires: python3-arrow BuildRequires: python3-pytest BuildRequires: python3-pytest-cov BuildRequires: python3-pytest-mock BuildRequires: python3-pytest-catchlog BuildRequires: python3-freezegun BuildRequires: python3-jinja2 %endif # with python3 %description A command-line utility that creates projects from cookiecutters (project templates), e.g. creating a Python package project from a Python package project template. %package -n python2-%{pkgname} Summary: %{summary} Recommends: python-%{pkgname}-doc %{?python_provide:%python_provide python2-%{pkgname}} %description -n python2-%{pkgname} A command-line utility that creates projects from cookiecutters (project templates), e.g. creating a Python package project from a Python package project template. %package -n python-%{pkgname}-doc Summary: Documentation for %{pkgname} %description -n python-%{pkgname}-doc Documentation for %{pkgname} %if %{with python3} %package -n python3-%{pkgname} Summary: %{summary} Recommends: python-%{pkgname}-doc %{?python_provide:%python_provide python3-%{pkgname}} %description -n python3-%{pkgname} A command-line utility that creates projects from cookiecutters (project templates), e.g. creating a Python package project from a Python package project template. %endif # with python3 %prep %autosetup -n %{pkgname}-%{version} # fix invocation of /usr/bin/python %if %{with python3} sed -i 's#python -c#%{__python3} -c#' Makefile %else sed -i 's#python -c#%{__python2} -c#' Makefile %endif # with python3 %build %{py2_build} %if %{with python3} %{py3_build} %endif # with python3 # make sphinx docs make docs %install %{py2_install} %if %{with python3} %{py3_install} %endif # with python3 %check %{__python2} setup.py test %if %{with python3} %{__python3} setup.py test %endif # with python3 %files -n python2-%{pkgname} %license LICENSE # For noarch packages: sitelib %{python2_sitelib}/* %if %{with python3} %files -n python3-%{pkgname} %license LICENSE # For noarch packages: sitelib %{python3_sitelib}/* %endif # with python3 %{_bindir}/%{pkgname} %files -n python-%{pkgname}-doc %license LICENSE %doc docs %doc *.rst %changelog * Thu Mar 1 2018 Brett Lentz - 1.6.0-1 - initial packaging