]>
Commit | Line | Data |
---|---|---|
0efef8c8 | 1 | # TODO: Use no-tree-dominator-opts for x32 only |
f818725e | 2 | |
595a528f ER |
3 | # Conditional build: |
4 | %bcond_without tests # do not perform "make test" | |
f818725e JK |
5 | %bcond_without python2 # CPython 2.x module |
6 | %bcond_without python3 # CPython 3.x module | |
7 | %bcond_without python2_tests # CPython 2.x module tests | |
8 | ||
9 | %if %{without tests} | |
10 | %undefine with_python2_tests | |
11 | %endif | |
595a528f ER |
12 | |
13 | %define module greenlet | |
14 | Summary: Lightweight in-process concurrent programming | |
15 | Name: python-%{module} | |
961cf9e4 | 16 | Version: 0.4.5 |
0efef8c8 | 17 | Release: 2 |
f818725e JK |
18 | License: MIT & PSF |
19 | Group: Libraries/Python | |
595a528f | 20 | URL: http://pypi.python.org/pypi/greenlet |
f818725e | 21 | Source0: http://pypi.python.org/packages/source/g/greenlet/%{module}-%{version}.zip |
961cf9e4 | 22 | # Source0-md5: ce383f6475e6311cf8932ea779938703 |
f818725e | 23 | %if %{with python2} |
595a528f ER |
24 | BuildRequires: python-devel |
25 | BuildRequires: python-setuptools | |
f818725e JK |
26 | %endif |
27 | %if %{with python3} | |
28 | BuildRequires: python3-2to3 | |
29 | BuildRequires: python3-devel | |
30 | BuildRequires: python3-distribute | |
31 | BuildRequires: python3-modules | |
32 | %endif | |
33 | BuildRequires: rpmbuild(macros) >= 1.219 | |
595a528f ER |
34 | BuildRequires: rpm-pythonprov |
35 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
36 | ||
37 | %description | |
38 | The greenlet package is a spin-off of Stackless, a version of CPython | |
39 | that supports micro-threads called "tasklets". Tasklets run | |
40 | pseudo-concurrently (typically in a single or a few OS-level threads) | |
41 | and are synchronized with data exchanges on "channels". | |
42 | ||
43 | %package devel | |
44 | Summary: C development headers for python-greenlet | |
45 | Group: Development/Libraries | |
46 | Requires: %{name} = %{version}-%{release} | |
47 | ||
48 | %description devel | |
49 | This package contains header files required for C modules development. | |
50 | ||
f818725e JK |
51 | %package -n python3-%{module} |
52 | Summary: Lightweight in-process concurrent programming | |
53 | Group: Libraries/Python | |
54 | ||
55 | %description -n python3-%{module} | |
56 | The greenlet package is a spin-off of Stackless, a version of CPython | |
57 | that supports micro-threads called "tasklets". Tasklets run | |
58 | pseudo-concurrently (typically in a single or a few OS-level threads) | |
59 | and are synchronized with data exchanges on "channels". | |
60 | ||
61 | %package -n python3-%{module}-devel | |
62 | Summary: C development headers for python3-greenlet | |
63 | Group: Development/Libraries | |
64 | Requires: python3-%{module} = %{version}-%{release} | |
65 | ||
66 | %description -n python3-%{module}-devel | |
67 | This package contains header files required for C modules development. | |
68 | ||
595a528f ER |
69 | %prep |
70 | %setup -q -n greenlet-%{version} | |
595a528f ER |
71 | |
72 | %build | |
f818725e | 73 | %if %{with python2} |
0efef8c8 | 74 | # -fno-tree-dominator-opts becouse https://bugzilla.opensuse.org/show_bug.cgi?id=902146 |
595a528f | 75 | CC="%{__cc}" \ |
12a27d84 | 76 | CFLAGS="%{rpmcflags} -fno-tree-dominator-opts" \ |
595a528f ER |
77 | %{__python} setup.py build |
78 | ||
f818725e | 79 | %if %{with python2_tests} |
595a528f ER |
80 | %{__python} setup.py test |
81 | ||
82 | # Run the upstream benchmarking suite to further exercise the code: | |
f818725e JK |
83 | PYTHONPATH=$(echo $(pwd)/build/lib.*-2.?) %{__python} benchmarks/chain.py |
84 | %endif | |
85 | %endif | |
86 | ||
87 | %if %{with python3} | |
0efef8c8 | 88 | # -fno-tree-dominator-opts becouse https://bugzilla.opensuse.org/show_bug.cgi?id=902146 |
f818725e | 89 | CC="%{__cc}" \ |
0efef8c8 | 90 | CFLAGS="%{rpmcflags} -fno-tree-dominator-opts" \ |
f818725e JK |
91 | %{__python3} setup.py build %{?with_tests:test} |
92 | ||
93 | %if %{with tests} | |
94 | # Run the upstream benchmarking suite to further exercise the code: | |
95 | mkdir -p benchmarks-3 | |
961cf9e4 | 96 | 2to3-3.4 -o benchmarks-3 -n -w --no-diffs benchmarks |
f818725e | 97 | PYTHONPATH=$(echo $(pwd)/build/lib.*-3.?) %{__python3} benchmarks-3/chain.py |
595a528f ER |
98 | %endif |
99 | %endif | |
100 | ||
101 | %install | |
f818725e JK |
102 | %if %{with python2} |
103 | %{__python} setup.py \ | |
104 | install --skip-build \ | |
595a528f ER |
105 | --optimize=2 \ |
106 | --root=$RPM_BUILD_ROOT | |
107 | ||
108 | %py_postclean | |
f818725e JK |
109 | %endif |
110 | ||
111 | %if %{with python3} | |
112 | %{__python3} setup.py \ | |
113 | install --skip-build \ | |
114 | --optimize=2 \ | |
115 | --root=$RPM_BUILD_ROOT | |
116 | %endif | |
595a528f ER |
117 | |
118 | %clean | |
119 | rm -rf $RPM_BUILD_ROOT | |
120 | ||
121 | %files | |
122 | %defattr(644,root,root,755) | |
f818725e | 123 | %doc doc/greenlet.txt README.rst benchmarks AUTHORS NEWS LICENSE |
595a528f ER |
124 | %attr(755,root,root) %{py_sitedir}/%{module}.so |
125 | %{py_sitedir}/%{module}*.egg-info | |
126 | ||
127 | %files devel | |
128 | %defattr(644,root,root,755) | |
129 | %{_includedir}/python%{py_ver}/greenlet | |
f818725e JK |
130 | |
131 | %files -n python3-%{module} | |
132 | %defattr(644,root,root,755) | |
133 | %doc doc/greenlet.txt README.rst benchmarks AUTHORS NEWS LICENSE | |
134 | %attr(755,root,root) %{py3_sitedir}/%{module}.*.so | |
135 | %{py3_sitedir}/%{module}*.egg-info | |
136 | ||
137 | %files -n python3-%{module}-devel | |
138 | %defattr(644,root,root,755) | |
139 | %{_includedir}/python%{py3_ver}*/greenlet |