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