]>
Commit | Line | Data |
---|---|---|
d28336cb AM |
1 | # Conditional build: |
2 | %bcond_without tests # unit tests | |
3 | %bcond_without python2 # CPython 2.x module | |
4 | %bcond_without python3 # CPython 3.x module | |
5 | ||
6 | %define module ratelimit | |
7 | %define egg_name ratelimit | |
8 | %define pypi_name ratelimit | |
9 | Summary: A function decorator preventing a function from being called more often than that allowed | |
10 | Name: python-%{module} | |
11 | Version: 2.2.1 | |
79dcb03c | 12 | Release: 2 |
d28336cb AM |
13 | License: MIT |
14 | Group: Libraries/Python | |
15 | Source0: https://github.com/tomasbasham/ratelimit/archive/refs/tags/v%{version}.tar.gz | |
16 | # Source0-md5: ef2e15527c4514751527157b588bb25e | |
17 | URL: https://github.com/tomasbasham/ratelimit | |
18 | %if %{with python2} | |
19 | BuildRequires: python-modules >= 1:2.5 | |
20 | BuildRequires: python-setuptools | |
21 | %if %{with tests} | |
22 | #BuildRequires: python- | |
23 | %endif | |
24 | %endif | |
25 | %if %{with python3} | |
26 | BuildRequires: python3-modules >= 1:3.2 | |
27 | BuildRequires: python3-setuptools | |
28 | %if %{with tests} | |
29 | #BuildRequires: python3- | |
30 | %endif | |
31 | %endif | |
32 | BuildRequires: rpm-pythonprov | |
33 | BuildRequires: rpmbuild(macros) >= 1.714 | |
34 | Requires: python-modules >= 1:2.5 | |
35 | BuildArch: noarch | |
36 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
37 | ||
38 | %description | |
39 | A function decorator preventing a function from being called more | |
40 | often than that allowed. | |
41 | ||
42 | %package -n python3-%{module} | |
43 | Summary: A function decorator preventing a function from being called more often than that allowed | |
44 | Group: Libraries/Python | |
45 | Requires: python3-modules >= 1:3.2 | |
46 | ||
47 | %description -n python3-%{module} | |
48 | A function decorator preventing a function from being called more | |
49 | often than that allowed. | |
50 | ||
51 | %prep | |
52 | %setup -q -n %{pypi_name}-%{version} | |
53 | ||
54 | %build | |
55 | %if %{with python2} | |
56 | %py_build | |
57 | ||
58 | %if %{with tests} | |
59 | %{__python} -m pytest tests | |
60 | %endif | |
61 | %endif | |
62 | ||
63 | %if %{with python3} | |
64 | %py3_build | |
65 | ||
66 | %if %{with tests} | |
67 | %{__python3} -m pytest tests | |
68 | %endif | |
69 | %endif | |
70 | ||
71 | %install | |
72 | rm -rf $RPM_BUILD_ROOT | |
73 | ||
74 | %if %{with python2} | |
75 | %py_install | |
76 | %py_postclean | |
77 | %endif | |
78 | ||
79 | %if %{with python3} | |
80 | %py3_install | |
81 | %endif | |
82 | ||
83 | %clean | |
84 | rm -rf $RPM_BUILD_ROOT | |
85 | ||
86 | %if %{with python2} | |
87 | %files | |
88 | %defattr(644,root,root,755) | |
89 | %doc README.rst | |
90 | %{py_sitescriptdir}/%{module} | |
91 | %{py_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info | |
92 | %endif | |
93 | ||
94 | %if %{with python3} | |
95 | %files -n python3-%{module} | |
96 | %defattr(644,root,root,755) | |
97 | %doc README.rst | |
98 | %{py3_sitescriptdir}/%{module} | |
99 | %{py3_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info | |
100 | %endif |