Blob Blame History Raw
%if 0%{?rhel} && 0%{?rhel} <= 6
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%endif

%global projectname cached-property
%global modulename cached_property
%global commit 2990020888089841314ad9dd4b0aa6f4d63c4d25 
%global shortcommit %(c=%{commit}; echo ${c:0:7})

Name:           python-%{modulename}
Version:        1.0.0 
Release:        2%{?dist}
Summary:        A cached-property for decorating methods in Python classes
License:        BSD
URL:            https://github.com/pydanny/%{projectname}
Source0:        https://github.com/pydanny/%{projectname}/archive/%{commit}/%{projectname}-%{commit}.tar.gz

BuildArch:      noarch
BuildRequires:  python2-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}-%{commit}
cp -a . %{py3dir}

%build
%{__python2} setup.py build
pushd %{py3dir}
%{__python3} setup.py build
popd

%install
%{__python2} setup.py install -O1 --skip-build --root %{buildroot}
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
popd

%check
tox --sitepackages --skip-missing-interpreters

%files
%doc AUTHORS.rst HISTORY.rst CONTRIBUTING.rst README.rst
%license LICENSE
%{python2_sitelib}/%{modulename}*

%files -n python3-%{projectname}
%doc AUTHORS.rst HISTORY.rst CONTRIBUTING.rst README.rst
%license LICENSE
%{python3_sitelib}/%{modulename}*
%{python3_sitelib}/__pycache__/%{modulename}*

%changelog
* Fri Mar 13 2015 Pete Travis <me@petetravis.com> - 1.0.0-2
- Use the module name for the package name.

* Fri Feb 20 2015 Pete Travis <me@petetravis.com> 1.0.0-1
- Initial packaging.