summaryrefslogtreecommitdiff
path: root/python-cached_property.spec
blob: e57f6b41b4706ddcc8edfc7fb93be69697708f45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#
# Conditional build:
%bcond_without	doc	# don't build doc
%bcond_with	tests	# do not perform "make test"
%bcond_without	python2 # CPython 2.x module
%bcond_without	python3 # CPython 3.x module

%define 	module	cached_property
Summary:	A cached-property for decorating methods in Python classes
Name:		python-%{module}
Version:	1.3.0
Release:	3
License:	BSD
Group:		Libraries/Python
Source0:	https://github.com/pydanny/cached-property/archive/34b1caf8/cached-property-%{version}.tar.gz
# Source0-md5:	973727514d27e4f4a07358802c4943dc
URL:		https://github.com/pydanny/cached-property
BuildRequires:	rpm-pythonprov
BuildRequires:	rpmbuild(macros) >= 1.714
%if %{with python2}
BuildRequires:	python-modules
BuildRequires:	python-setuptools
%if %{with tests}
BuildRequires:	python-freezegun
BuildRequires:	python-pytest
BuildRequires:	python-tox >= 1.7.2
%endif
%endif
%if %{with python3}
BuildRequires:	python3-modules
BuildRequires:	python3-setuptools
%if %{with tests}
BuildRequires:	python3-freezegun
BuildRequires:	python3-pytest
%endif
%endif
BuildArch:	noarch
BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)

%description
cached_property allows properties in Python classes to be cached until
the cache is invalidated or expired.

%package -n python3-%{module}
Summary:	A cached-property for decorating methods in Python classes
Group:		Libraries/Python

%description -n python3-%{module}
cached_property allows properties in Python classes to be cached until
the cache is invalidated or expired.

%prep
%setup -qc
mv cached-property-*/* .

%build
%if %{with python2}
%py_build
%endif

%if %{with python3}
%py3_build
%endif

%if %{with tests}
# FIXME: python3 tests do not run: it wants %{_bindir}/py.test but python3-pytest provides %{_bindir}/py.test-3.4
tox --sitepackages --skip-missing-interpreters
%endif

%install
rm -rf $RPM_BUILD_ROOT
%if %{with python2}
%py_install
%py_postclean
%endif

%if %{with python3}
%py3_install
%endif

%clean
rm -rf $RPM_BUILD_ROOT

%if %{with python2}
%files
%defattr(644,root,root,755)
%doc AUTHORS.rst HISTORY.rst CONTRIBUTING.rst README.rst LICENSE
%{py_sitescriptdir}/%{module}.py[co]
%{py_sitescriptdir}/%{module}-%{version}-py*.egg-info
%endif

%if %{with python3}
%files -n python3-%{module}
%defattr(644,root,root,755)
%doc AUTHORS.rst HISTORY.rst CONTRIBUTING.rst README.rst LICENSE
%{py3_sitescriptdir}/%{module}.py
%{py3_sitescriptdir}/__pycache__/%{module}.*.pyc
%{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info
%endif