]>
Commit | Line | Data |
---|---|---|
f91d20c1 | 1 | # NOTE: for versions >= 4 for python 3.5+ see python3-pyfakefs.spec |
792227e6 JB |
2 | # |
3 | # Conditional build: | |
4 | %bcond_without doc # Sphinx documentation | |
5 | %bcond_without tests # unit tests | |
6 | %bcond_without python2 # CPython 2.x module | |
f91d20c1 | 7 | %bcond_with python3 # CPython 3.x module (built from python3-pyfakefs.spec) |
792227e6 JB |
8 | |
9 | Summary: Fake file system that mocks the Python 2 file system modules | |
10 | Summary(pl.UTF-8): Fałszywy system plików będący atrapą modułów systemowych Pythona 2 dla plików | |
11 | Name: python-pyfakefs | |
f91d20c1 | 12 | # NOTE: keep 3.x for python2 support |
937394ee JB |
13 | Version: 3.7.2 |
14 | Release: 1 | |
792227e6 JB |
15 | License: Apache v2.0 |
16 | Group: Libraries/Python | |
17 | #Source0Download: https://github.com/jmcgeheeiv/pyfakefs/releases | |
18 | Source0: https://github.com/jmcgeheeiv/pyfakefs/archive/v%{version}/pyfakefs-%{version}.tar.gz | |
937394ee | 19 | # Source0-md5: e34234db867202b035d48a77d1c78d82 |
792227e6 JB |
20 | URL: http://pyfakefs.org/ |
21 | BuildRequires: rpm-pythonprov | |
22 | BuildRequires: rpmbuild(macros) >= 1.714 | |
23 | %{?with_doc:BuildRequires: sphinx-pdg >= 1.0} | |
24 | %if %{with python2} | |
25 | BuildRequires: python-modules >= 1:2.7 | |
792227e6 | 26 | BuildRequires: python-setuptools |
937394ee JB |
27 | %if %{with tests} |
28 | BuildRequires: python-pathlib2 >= 2.3.2 | |
29 | BuildRequires: python-pytest >= 2.8.6 | |
30 | BuildRequires: python-scandir >= 1.8 | |
31 | %endif | |
792227e6 JB |
32 | %endif |
33 | %if %{with python3} | |
937394ee | 34 | BuildRequires: python3-modules >= 1:3.4 |
792227e6 | 35 | BuildRequires: python3-setuptools |
937394ee JB |
36 | %if %{with tests} |
37 | BuildRequires: python3-pytest >= 2.8.6 | |
38 | %if "%{py3_ver}" < "3.6" | |
39 | BuildRequires: python3-pathlib2 >= 2.3.2 | |
40 | BuildRequires: python3-scandir >= 1.8 | |
41 | %endif | |
42 | %endif | |
792227e6 JB |
43 | %endif |
44 | Requires: python-modules >= 1:2.7 | |
45 | BuildArch: noarch | |
46 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
47 | ||
48 | %description | |
49 | pyfakefs implements a fake file system that mocks the Python file | |
50 | system modules. Using pyfakefs, your tests operate on a fake file | |
51 | system in memory without touching the real disk. The software under | |
52 | test requires no modification to work with pyfakefs. | |
53 | ||
54 | %description -l pl.UTF-8 | |
55 | pyfakefs implementuje fałszywy system plików, będący atrapą dla | |
56 | modułów systemowych Pythona dla plików. Przy użyciu pyfakefs testy | |
57 | operują na fałszywym systemie plików w pamięci, bez dotykania | |
58 | prawdziwego dysku. Testowane oprogramowanie nie wymaga modyfikacji, | |
59 | aby działało z pyfakefs. | |
60 | ||
61 | %package -n python3-pyfakefs | |
62 | Summary: Fake file system that mocks the Python 3 file system modules | |
63 | Summary(pl.UTF-8): Fałszywy system plików będący atrapą modułów systemowych Pythona 3 dla plików | |
64 | Group: Libraries/Python | |
937394ee | 65 | Requires: python3-modules >= 1:3.4 |
792227e6 JB |
66 | |
67 | %description -n python3-pyfakefs | |
68 | pyfakefs implements a fake file system that mocks the Python file | |
69 | system modules. Using pyfakefs, your tests operate on a fake file | |
70 | system in memory without touching the real disk. The software under | |
71 | test requires no modification to work with pyfakefs. | |
72 | ||
73 | %description -n python3-pyfakefs -l pl.UTF-8 | |
74 | pyfakefs implementuje fałszywy system plików, będący atrapą dla | |
75 | modułów systemowych Pythona dla plików. Przy użyciu pyfakefs testy | |
76 | operują na fałszywym systemie plików w pamięci, bez dotykania | |
77 | prawdziwego dysku. Testowane oprogramowanie nie wymaga modyfikacji, | |
78 | aby działało z pyfakefs. | |
79 | ||
80 | %package apidocs | |
81 | Summary: API documentation for Python pyfakefs module | |
82 | Summary(pl.UTF-8): Dokumentacja API modułu Pythona pyfakefs | |
83 | Group: Documentation | |
84 | ||
85 | %description apidocs | |
86 | API documentation for Pythona pyfakefs module. | |
87 | ||
88 | %description apidocs -l pl.UTF-8 | |
89 | Dokumentacja API modułu Pythona pyfakefs. | |
90 | ||
91 | %prep | |
92 | %setup -q -n pyfakefs-%{version} | |
792227e6 JB |
93 | |
94 | %build | |
95 | export LC_ALL=C.UTF-8 | |
96 | %if %{with python2} | |
97 | %py_build | |
98 | ||
99 | %if %{with tests} | |
08eb5322 | 100 | %{__python} -m pyfakefs.tests.all_tests |
937394ee JB |
101 | # fails on pathlib |
102 | #%{__python} -m pyfakefs.tests.all_tests_without_extra_packages | |
103 | ||
104 | PYTHONPATH=$(pwd) \ | |
105 | PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ | |
106 | PYTEST_PLUGINS=pyfakefs.pytest_plugin \ | |
107 | %{__python} -m pytest \ | |
108 | pyfakefs/pytest_tests/pytest_plugin_test.py | |
109 | # fails with python2 (any < 3.6?) | |
110 | #pyfakefs/pytest_tests/pytest_fixture_test.py | |
c45d0be8 JB |
111 | |
112 | PYTHONPATH=$(pwd) \ | |
113 | PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ | |
114 | PYTEST_PLUGINS=pyfakefs.pytest_plugin \ | |
937394ee JB |
115 | %{__python} -m pytest \ |
116 | pyfakefs/pytest_tests/pytest_plugin_failing_test.py > testresult.txt || : | |
117 | %{__python} -m pytest \ | |
118 | pyfakefs/pytest_tests/pytest_check_failed_plugin_test.py | |
792227e6 JB |
119 | %endif |
120 | %endif | |
121 | ||
122 | %if %{with python3} | |
123 | %py3_build | |
124 | ||
125 | %if %{with tests} | |
08eb5322 | 126 | %{__python3} -m pyfakefs.tests.all_tests |
937394ee JB |
127 | %{__python3} -m pyfakefs.tests.all_tests_without_extra_packages |
128 | ||
129 | PYTHONPATH=$(pwd) \ | |
130 | PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ | |
131 | PYTEST_PLUGINS=pyfakefs.pytest_plugin \ | |
132 | %{__python3} -m pytest \ | |
133 | pyfakefs/pytest_tests/pytest_fixture_test.py \ | |
134 | pyfakefs/pytest_tests/pytest_plugin_test.py | |
135 | ||
c45d0be8 JB |
136 | PYTHONPATH=$(pwd) \ |
137 | PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ | |
138 | PYTEST_PLUGINS=pyfakefs.pytest_plugin \ | |
937394ee JB |
139 | %{__python3} -m pytest \ |
140 | pyfakefs/pytest_tests/pytest_plugin_failing_test.py > testresult.txt || : | |
141 | %{__python3} -m pytest \ | |
142 | pyfakefs/pytest_tests/pytest_check_failed_plugin_test.py | |
792227e6 JB |
143 | %endif |
144 | %endif | |
145 | ||
146 | %if %{with doc} | |
147 | %{__make} -C docs html | |
148 | %endif | |
149 | ||
150 | %install | |
151 | rm -rf $RPM_BUILD_ROOT | |
152 | ||
153 | %if %{with python2} | |
154 | %py_install | |
155 | ||
156 | %py_postclean | |
157 | %endif | |
158 | ||
159 | %if %{with python3} | |
160 | %py3_install | |
161 | %endif | |
162 | ||
163 | %clean | |
164 | rm -rf $RPM_BUILD_ROOT | |
165 | ||
166 | %if %{with python2} | |
167 | %files | |
168 | %defattr(644,root,root,755) | |
169 | %doc CHANGES.md README.md | |
170 | %{py_sitescriptdir}/pyfakefs | |
171 | %{py_sitescriptdir}/pyfakefs-%{version}-py*.egg-info | |
172 | %endif | |
173 | ||
174 | %if %{with python3} | |
175 | %files -n python3-pyfakefs | |
176 | %defattr(644,root,root,755) | |
177 | %doc CHANGES.md README.md | |
178 | %{py3_sitescriptdir}/pyfakefs | |
179 | %{py3_sitescriptdir}/pyfakefs-%{version}-py*.egg-info | |
180 | %endif | |
181 | ||
182 | %if %{with doc} | |
183 | %files apidocs | |
184 | %defattr(644,root,root,755) | |
185 | %doc gh-pages/{_static,*.html,*.js} | |
186 | %endif |