# sitelib for noarch packages, sitearch for others (remove the unneeded one) %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} %global projectname cached-property Name: python-%{projectname} Version: 1.0.0 Release: 1%{?dist} Summary: A cached-property for decorating methods in Python classes. License: BSD URL: https://github.com/pydanny/cached-property Source0: https://github.com/pydanny/%{projectname}/archive/%{version}.tar.gz BuildArch: noarch BuildRequires: python-devel BuildRequires: python-tox BuildRequires: python-freezegun BuildRequires: python3-devel BuildRequires: python3-freezegun %description cached_property allows properties in Python classes to be cached until the cache is invalidated or expired. %package -n python3-%{projectname} Summary: A cached-property for decorating methods in Python classes. %description -n python3-%{projectname} cached_property allows properties in Python classes to be cached until the cache is invalidated or expired. %prep %setup -q -n %{projectname}-%{version} cp -a . %{py3dir} %build # Remove CFLAGS=... for noarch packages (unneeded) CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build pushd %{py3dir} %{__python3} setup.py build popd %install %{__python} setup.py install -O1 --skip-build --root %{buildroot} pushd %{py3dir} %{__python3} setup.py install -O1 --skip-build --root %{buildroot} %check tox --sitepackages --skip-missing-interpreters %files %doc AUTHORS.rst HISTORY.rst CONTRIBUTING.rst README.rst %license LICENSE %{python_sitelib}/cached_property* %files -n python3-%{projectname} %doc AUTHORS.rst HISTORY.rst CONTRIBUTING.rst README.rst %license LICENSE %{python3_sitelib}/cached_property* %{python3_sitelib}/__pycache__/cached_property* %changelog * Fri Feb 20 2015 Pete Travis - Initial packaging.