]>
Commit | Line | Data |
---|---|---|
9194026a JB |
1 | # NOTE: unittest2 1.1.0 is backport of unittest from cpython between 3.4.0/3.5.0 |
2 | # unittest from cpython>=3.5.0 seems more robust | |
4c16811f JB |
3 | # |
4 | # Conditional build: | |
5 | %bcond_without python2 # CPython 2.x module | |
e110ba30 JR |
6 | %bcond_with python3 # CPython 3.x module |
7 | %bcond_with tests # test target | |
4c16811f JB |
8 | |
9 | Summary: New features in unittest backported to older Python versions | |
10 | Summary(pl.UTF-8): Backport nowych funkcji modułu unittest do starszych wersji Pythona | |
11 | Name: python-unittest2 | |
12 | Version: 1.1.0 | |
e110ba30 | 13 | Release: 6 |
4c16811f JB |
14 | License: MIT |
15 | Group: Development/Tools | |
9194026a JB |
16 | #Source0Download: https://pypi.org/simple/unittest2/ |
17 | Source0: https://files.pythonhosted.org/packages/source/u/unittest2/unittest2-%{version}.tar.gz | |
4c16811f | 18 | # Source0-md5: f72dae5d44f091df36b6b513305ea000 |
9194026a | 19 | URL: https://pypi.org/project/unittest2/ |
4c16811f JB |
20 | %if %{with python2} |
21 | BuildRequires: python-devel >= 1:2.6 | |
22 | BuildRequires: python-setuptools | |
3c2cb9aa | 23 | BuildRequires: python-traceback2 |
4c16811f JB |
24 | %if %{with tests} |
25 | %if "%{py_ver}" < "2.7" | |
26 | BuildRequires: python-argparse | |
27 | %endif | |
28 | BuildRequires: python-six >= 1.4 | |
4c16811f JB |
29 | %endif |
30 | %endif | |
31 | %if %{with python3} | |
32 | BuildRequires: python3-devel >= 1:3.2 | |
33 | BuildRequires: python3-setuptools | |
3c2cb9aa | 34 | BuildRequires: python3-traceback2 |
4c16811f JB |
35 | %if %{with tests} |
36 | BuildRequires: python3-six >= 1.4 | |
4c16811f JB |
37 | %endif |
38 | %endif | |
39 | BuildRequires: rpmbuild(macros) >= 1.714 | |
4c16811f JB |
40 | BuildArch: noarch |
41 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
42 | ||
43 | %description | |
44 | unittest2 is a backport of the new features added to the unittest | |
45 | testing framework in Python 2.7 and onwards. | |
46 | ||
47 | %description -l pl.UTF-8 | |
48 | unittest2 to backport nowych funkcji dodanych do szkieletu testów | |
49 | unittest w Pythonie 2.7 i nowszych. | |
50 | ||
51 | %package -n python3-unittest2 | |
52 | Summary: New features in unittest backported to older Python versions | |
53 | Summary(pl.UTF-8): Backport nowych funkcji modułu unittest do starszych wersji Pythona | |
54 | Group: Development/Tools | |
4c16811f JB |
55 | |
56 | %description -n python3-unittest2 | |
57 | unittest2 is a backport of the new features added to the unittest | |
58 | testing framework in Python 2.7 and onwards. | |
59 | ||
60 | %description -n python3-unittest2 -l pl.UTF-8 | |
61 | unittest2 to backport nowych funkcji dodanych do szkieletu testów | |
62 | unittest w Pythonie 2.7 i nowszych. | |
63 | ||
64 | %prep | |
65 | %setup -q -n unittest2-%{version} | |
66 | ||
67 | %if "%{py_ver}" >= "2.7" | |
68 | # argparse is in base distribution | |
69 | %{__sed} -i -e "/^REQUIRES/s@'argparse', @@" setup.py | |
70 | %endif | |
71 | ||
72 | %build | |
73 | %if %{with python2} | |
74 | %py_build %{?with_tests:test} | |
75 | %endif | |
76 | ||
77 | %if %{with python3} | |
78 | %py_build %{?with_tests:test} | |
79 | %endif | |
80 | ||
81 | %install | |
82 | rm -rf $RPM_BUILD_ROOT | |
83 | ||
84 | %if %{with python2} | |
85 | %py_install | |
86 | ||
87 | %{__mv} $RPM_BUILD_ROOT%{_bindir}/unit2{,-2} | |
88 | ||
89 | %py_postclean | |
90 | %{__rm} -r $RPM_BUILD_ROOT%{py_sitescriptdir}/unittest2/test | |
91 | %endif | |
92 | ||
93 | %if %{with python3} | |
94 | %py3_install | |
95 | ||
96 | %{__mv} $RPM_BUILD_ROOT%{_bindir}/unit2{,-3} | |
97 | ||
98 | %{__rm} -r $RPM_BUILD_ROOT%{py3_sitescriptdir}/unittest2/test | |
99 | %endif | |
100 | ||
101 | %if %{with python2} | |
102 | ln -sf unit2-2 $RPM_BUILD_ROOT%{_bindir}/unit2 | |
103 | %endif | |
104 | ||
105 | %clean | |
106 | rm -rf $RPM_BUILD_ROOT | |
107 | ||
108 | %if %{with python2} | |
109 | %files | |
110 | %defattr(644,root,root,755) | |
111 | %doc README.txt | |
112 | %attr(755,root,root) %{_bindir}/unit2 | |
113 | %attr(755,root,root) %{_bindir}/unit2-2 | |
114 | %dir %{py_sitescriptdir}/unittest2 | |
115 | %{py_sitescriptdir}/unittest2/*.py[co] | |
116 | %{py_sitescriptdir}/unittest2-%{version}-py*.egg-info | |
117 | %endif | |
118 | ||
119 | %if %{with python3} | |
120 | %files -n python3-unittest2 | |
121 | %defattr(644,root,root,755) | |
122 | %doc README.txt | |
123 | %attr(755,root,root) %{_bindir}/unit2-3 | |
124 | %dir %{py3_sitescriptdir}/unittest2 | |
125 | %{py3_sitescriptdir}/unittest2/*.py | |
126 | %{py3_sitescriptdir}/unittest2/__pycache__ | |
127 | %{py3_sitescriptdir}/unittest2-%{version}-py*.egg-info | |
128 | %endif |