summaryrefslogtreecommitdiff
path: root/python-greenlet.spec
blob: 567cf30086d86b584204a9c1415f5aeaf079c002 (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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
#
# Conditional build:
%bcond_without	python2		# CPython 2.x module
%bcond_without	python3		# CPython 3.x module
%bcond_without	doc		# Sphinx documentation
%bcond_without	tests		# unit tests and benchmarks (any)
%bcond_without	tests_py2	# CPython 2.x module tests

%if %{without tests}
%undefine	with_tests_py2
%endif

%define 	module	greenlet
Summary:	Lightweight in-process concurrent programming
Summary(pl.UTF-8):	Lekkie programowanie równoległe wewnątrz procesu
Name:		python-%{module}
Version:	1.1.2
Release:	4
License:	MIT, PSF (Stackless Python parts)
Group:		Libraries/Python
#Source0Download: https://pypi.org/simple/greenlet/
Source0:	https://files.pythonhosted.org/packages/source/g/greenlet/%{module}-%{version}.tar.gz
# Source0-md5:	f424fbd9afeed575dd2ba5f0ac66e30b
Patch0:		%{name}-py3.8.patch
URL:		https://pypi.org/project/greenlet/
BuildRequires:	rpm-pythonprov
BuildRequires:	rpmbuild(macros) >= 1.714
%if %{with python2}
BuildRequires:	python-devel >= 1:2.7
BuildRequires:	python-setuptools
%endif
%if %{with python3}
BuildRequires:	python3-2to3 >= 1:3.5
BuildRequires:	python3-devel >= 1:3.5
BuildRequires:	python3-setuptools
BuildRequires:	python3-modules >= 1:3.5
%endif
%if %{with doc}
BuildRequires:	sphinx-pdg-3
%endif
Requires:	python-modules >= 1:2.7
BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)

# -fno-tree-dominator-opts because https://bugzilla.opensuse.org/show_bug.cgi?id=902146
%define		specflags_x32	-fno-tree-dominator-opts

%description
The greenlet package is a spin-off of Stackless, a version of CPython
that supports micro-threads called "tasklets". Tasklets run
pseudo-concurrently (typically in a single or a few OS-level threads)
and are synchronized with data exchanges on "channels".

%description -l pl.UTF-8
Pakiet greenlet to odprysk projektu Stackless - wersji CPythona
obsługującej mikrowątki zwane "taskletami". Tasklety działają
pseudorównolegle (zwykle w jednym lub kilku wątkach na poziomie
systemu operacyjnego) i są synchronizowane przy wymianie danych
poprzez "kanały".

%package devel
Summary:	C development headers for Python 2 greenlet module
Summary(pl.UTF-8):	Pliki nagłówkowe C dla modułu Pythona 2 greenlet
Group:		Development/Libraries
Requires:	%{name} = %{version}-%{release}
Requires:	python-devel >= 1:2.7

%description devel
This package contains header files required for C modules development.

%description devel -l pl.UTF-8
Ten pakiet zawiera pliki nagłówkowe potrzebne do tworzenia modułów w
C.

%package -n python3-%{module}
Summary:	Lightweight in-process concurrent programming
Summary(pl.UTF-8):	Lekkie programowanie równoległe wewnątrz procesu
Group:		Libraries/Python
Requires:	python3-modules >= 1:3.5

%description -n python3-%{module}
The greenlet package is a spin-off of Stackless, a version of CPython
that supports micro-threads called "tasklets". Tasklets run
pseudo-concurrently (typically in a single or a few OS-level threads)
and are synchronized with data exchanges on "channels".

%description -n python3-%{module} -l pl.UTF-8
Pakiet greenlet to odprysk projektu Stackless - wersji CPythona
obsługującej mikrowątki zwane "taskletami". Tasklety działają
pseudorównolegle (zwykle w jednym lub kilku wątkach na poziomie
systemu operacyjnego) i są synchronizowane przy wymianie danych
poprzez "kanały".

%package -n python3-%{module}-devel
Summary:	C development headers for Python 3 greenlet module
Summary(pl.UTF-8):	Pliki nagłówkowe C dla modułu Pythona 3 greenlet
Group:		Development/Libraries
Requires:	python3-%{module} = %{version}-%{release}
Requires:	python3-devel >= 1:3.5

%description -n python3-%{module}-devel
This package contains header files required for C modules development.

%description -n python3-%{module}-devel -l pl.UTF-8
Ten pakiet zawiera pliki nagłówkowe potrzebne do tworzenia modułów w
C.

%package apidocs
Summary:	API documentation for Python greenlet module
Summary(pl.UTF-8):	Dokumentacja API modułu Pythona greenlet
Group:		Documentation

%description apidocs
API documentation for Python greenlet module.

%description apidocs -l pl.UTF-8
Dokumentacja API modułu Pythona greenlet.

%prep
%setup -q -n greenlet-%{version}
%patch0 -p1

%build
%if %{with python2}
%py_build

%if %{with tests_py2}
BUILDDIR=$(echo $(pwd)/build-2/lib.linux-*)
PYTHONPATH="$BUILDDIR" \
%{__python} -m unittest discover greenlet.tests

# Run the upstream benchmarking suite to further exercise the code:
PYTHONPATH="$BUILDDIR" \
%{__python} benchmarks/chain.py
%endif
%endif

%if %{with python3}
%py3_build

%if %{with tests}
BUILDDIR=$(echo $(pwd)/build-3/lib.linux-*)
PYTHONPATH="$BUILDDIR" \
%{__python3} -m unittest discover greenlet.tests

# Run the upstream benchmarking suite to further exercise the code:
mkdir -p benchmarks-3
2to3-%{py3_ver} -o benchmarks-3 -n -w --no-diffs benchmarks
PYTHONPATH="$BUILDDIR" \
%{__python3} benchmarks-3/chain.py
%endif
%endif

%if %{with doc}
PYTHONPATH=$(echo $(pwd)/build-3/lib.linux-*) \
%{__make} -C docs html \
	SPHINXBUILD=sphinx-build-3
%endif

%install
rm -rf $RPM_BUILD_ROOT

%if %{with python2}
%py_install

%{__rm} $RPM_BUILD_ROOT%{py_sitedir}/greenlet/*.[ch]
%{__rm} -r $RPM_BUILD_ROOT%{py_sitedir}/greenlet/{platform,tests}
%py_postclean
%endif

%if %{with python3}
%py3_install

%{__rm} $RPM_BUILD_ROOT%{py3_sitedir}/greenlet/*.[ch]
%{__rm} -r $RPM_BUILD_ROOT%{py3_sitedir}/greenlet/{platform,tests}
%endif

%clean
rm -rf $RPM_BUILD_ROOT

%if %{with python2}
%files
%defattr(644,root,root,755)
%doc AUTHORS CHANGES.rst LICENSE README.rst benchmarks
%dir %{py_sitedir}/greenlet
%attr(755,root,root) %{py_sitedir}/greenlet/_greenlet.so
%{py_sitedir}/greenlet/*.py[co]
%{py_sitedir}/greenlet-%{version}-py*.egg-info

%files devel
%defattr(644,root,root,755)
%{_includedir}/python%{py_ver}/greenlet
%endif

%if %{with python3}
%files -n python3-%{module}
%defattr(644,root,root,755)
%doc AUTHORS CHANGES.rst LICENSE README.rst %{?with_tests:benchmarks-3}
%dir %{py3_sitedir}/greenlet
%attr(755,root,root) %{py3_sitedir}/greenlet/_greenlet.cpython-*.so
%{py3_sitedir}/greenlet/*.py
%{py3_sitedir}/greenlet/__pycache__
%{py3_sitedir}/greenlet-%{version}-py*.egg-info

%files -n python3-%{module}-devel
%defattr(644,root,root,755)
%{_includedir}/python%{py3_ver}*/greenlet
%endif

%if %{with doc}
%files apidocs
%defattr(644,root,root,755)
%doc docs/_build/html/{_modules,_static,*.html,*.js}
%endif