]>
Commit | Line | Data |
---|---|---|
f65af884 ER |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without tests # do not perform "make test" | |
4 | %bcond_without python2 # CPython 2.x module | |
5 | %bcond_with python3 # CPython 3.x module (not needed for Python 3.4+) | |
6 | ||
7 | Summary: Backport of Python 3.4 Enum | |
8 | Name: python-enum34 | |
9 | Version: 1.0.4 | |
ce6a1439 | 10 | Release: 2 |
f65af884 ER |
11 | License: BSD |
12 | Group: Development/Libraries | |
13 | Source0: https://pypi.python.org/packages/source/e/enum34/enum34-%{version}.tar.gz | |
14 | # Source0-md5: ac80f432ac9373e7d162834b264034b6 | |
15 | URL: https://pypi.python.org/pypi/enum34 | |
16 | BuildRequires: rpm-pythonprov | |
17 | BuildRequires: rpmbuild(macros) >= 1.219 | |
18 | %if %{with python2} | |
19 | BuildRequires: python | |
20 | BuildRequires: python-setuptools | |
21 | %endif | |
22 | %if %{with python3} | |
23 | BuildRequires: python3 | |
24 | BuildRequires: python3-setuptools | |
25 | %endif | |
26 | BuildArch: noarch | |
27 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
28 | ||
29 | %description | |
30 | Python 3.4 introduced official support for enumerations. This is a | |
e6182a11 | 31 | backport of that feature to Python 3.3, 3.2, 3.1, 2.7, 2.6, 2.5, and |
f65af884 ER |
32 | 2.4. |
33 | ||
34 | An enumeration is a set of symbolic names (members) bound to unique, | |
35 | constant values. Within an enumeration, the members can be compared by | |
36 | identity, and the enumeration itself can be iterated over. | |
37 | ||
38 | This module defines two enumeration classes that can be used to define | |
39 | unique sets of names and values: Enum and IntEnum. It also defines one | |
40 | decorator, unique, that ensures only unique member names are present | |
41 | in an enumeration. | |
42 | ||
43 | %package -n python3-enum34 | |
44 | Summary: Backport of Python 3.4 Enum | |
45 | Group: Development/Libraries | |
46 | ||
47 | %description -n python3-enum34 | |
48 | Python 3.4 introduced official support for enumerations. This is a | |
e6182a11 | 49 | backport of that feature to Python 3.3, 3.2, 3.1, 2.7, 2.6, 2.5, and |
f65af884 ER |
50 | 2.4. |
51 | ||
52 | An enumeration is a set of symbolic names (members) bound to unique, | |
53 | constant values. Within an enumeration, the members can be compared by | |
54 | identity, and the enumeration itself can be iterated over. | |
55 | ||
56 | This module defines two enumeration classes that can be used to define | |
57 | unique sets of names and values: Enum and IntEnum. It also defines one | |
58 | decorator, unique, that ensures only unique member names are present | |
59 | in an enumeration. | |
60 | ||
61 | %prep | |
62 | %setup -q -n enum34-%{version} | |
63 | ||
64 | %build | |
65 | %if %{with python2} | |
18f31992 | 66 | %py_build |
f65af884 ER |
67 | %{?with_tests:%{__python} enum/test_enum.py} |
68 | %endif | |
69 | ||
70 | %if %{with python3} | |
18f31992 | 71 | %py3_build |
f65af884 ER |
72 | %{?with_tests:%{__python3} enum/test_enum.py} |
73 | %endif | |
74 | ||
75 | %install | |
76 | rm -rf $RPM_BUILD_ROOT | |
77 | %if %{with python2} | |
18f31992 | 78 | %py_install |
f65af884 ER |
79 | |
80 | rm -r $RPM_BUILD_ROOT%{py_sitescriptdir}/enum/{LICENSE,README,doc} | |
81 | rm -r $RPM_BUILD_ROOT%{py_sitescriptdir}/enum/test_*.py* | |
82 | ||
83 | %py_postclean | |
84 | %endif | |
85 | ||
86 | %if %{with python3} | |
18f31992 | 87 | %py3_install |
f65af884 ER |
88 | |
89 | rm -r $RPM_BUILD_ROOT%{py3_sitescriptdir}/enum/{LICENSE,README,doc} | |
90 | rm $RPM_BUILD_ROOT%{py3_sitescriptdir}/enum/test_enum.py | |
91 | %endif | |
92 | ||
93 | ||
94 | %clean | |
95 | rm -rf $RPM_BUILD_ROOT | |
96 | ||
97 | %if %{with python2} | |
98 | %files | |
99 | %defattr(644,root,root,755) | |
100 | %doc PKG-INFO enum/LICENSE enum/README enum/doc/enum.rst | |
101 | %dir %{py_sitescriptdir}/enum | |
102 | %{py_sitescriptdir}/enum/*.py[co] | |
103 | %{py_sitescriptdir}/enum34-%{version}-py*.egg-info | |
104 | %endif | |
105 | ||
106 | %if %{with python3} | |
107 | %files -n python3-enum34 | |
108 | %defattr(644,root,root,755) | |
109 | %doc PKG-INFO enum/LICENSE enum/README enum/doc/enum.rst | |
110 | %{py3_sitescriptdir}/enum/*.py | |
111 | %{py3_sitescriptdir}/enum/__pycache__ | |
112 | %{py3_sitescriptdir}/enum34-%{version}-py*.egg-info | |
113 | %endif |