]>
Commit | Line | Data |
---|---|---|
1 | # | |
2 | # Conditional build: | |
3 | %bcond_without python2 # CPython 2.x module | |
4 | %bcond_without python3 # CPython 3.x module | |
5 | ||
6 | %define module Cython | |
7 | ||
8 | Summary: Language for writing Python Extension Modules (Python 2.x version) | |
9 | Summary(pl.UTF-8): Język służący do pisania modułów rozszerzających Pythona (wersja dla Pythona 2.x) | |
10 | Name: python-%{module} | |
11 | Version: 0.22 | |
12 | Release: 2 | |
13 | License: Apache v2.0 | |
14 | Group: Libraries/Python | |
15 | Source0: http://cython.org/release/%{module}-%{version}.tar.gz | |
16 | # Source0-md5: 1ae25add4ef7b63ee9b4af697300d6b6 | |
17 | URL: http://cython.org/ | |
18 | %if %{with python2} | |
19 | BuildRequires: python >= 1:2.6 | |
20 | BuildRequires: python-devel >= 1:2.6 | |
21 | %endif | |
22 | %if %{with python3} | |
23 | BuildRequires: python3 >= 1:3.2 | |
24 | BuildRequires: python3-2to3 >= 1:3.2 | |
25 | BuildRequires: python3-devel >= 1:3.2 | |
26 | BuildRequires: python3-distribute | |
27 | BuildRequires: python3-modules >= 1:3.2 | |
28 | %endif | |
29 | BuildRequires: rpm-pythonprov | |
30 | Requires: python-devel >= 1:2.6 | |
31 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
32 | ||
33 | %define _noautocompressdoc *.c | |
34 | ||
35 | %description | |
36 | Cython lets you write code that mixes Python and C data types any way | |
37 | you want, and compiles it into a C extension for Python. Cython is | |
38 | based on Pyrex. | |
39 | ||
40 | This package contains Cython module for Python 2.x. | |
41 | ||
42 | %description -l pl.UTF-8 | |
43 | Cython pozwala pisać kod zawierający dane Pythona i języka C połączone | |
44 | w jakikolwiek sposób i kompiluje to jako rozszerzenie C dla Pythona. | |
45 | Cython jest oparty na Pyreksie. | |
46 | ||
47 | Ten pakiet zawiera moduł Cython dla Pythona 2.x. | |
48 | ||
49 | %package -n python3-Cython | |
50 | Summary: Language for writing Python Extension Modules (Python 3.x version) | |
51 | Summary(pl.UTF-8): Język służący do pisania modułów rozszerzających Pythona (wersja dla Pythona 3.x) | |
52 | Group: Libraries/Python | |
53 | Requires: python3-devel >= 1:3.2 | |
54 | ||
55 | %description -n python3-Cython | |
56 | Cython lets you write code that mixes Python and C data types any way | |
57 | you want, and compiles it into a C extension for Python. Cython is | |
58 | based on Pyrex. | |
59 | ||
60 | This package contains Cython module for Python 3.x. | |
61 | ||
62 | %description -n python3-Cython -l pl.UTF-8 | |
63 | Pyrex pozwala pisać kod zawierający dane Pythona i języka C połączone | |
64 | w jakikolwiek sposób i kompiluje to jako rozszerzenie C dla Pythona. | |
65 | Cython jest oparty na Pyreksie. | |
66 | ||
67 | Ten pakiet zawiera moduł Cython dla Pythona 3.x. | |
68 | ||
69 | %package examples | |
70 | Summary: Examples for Cython language | |
71 | Summary(pl.UTF-8): Przykłady programów w języku Cython | |
72 | Group: Libraries/Python | |
73 | Obsoletes: python3-Cython-examples | |
74 | ||
75 | %description examples | |
76 | This package contains example programs for Cython language. | |
77 | ||
78 | %description examples -l pl.UTF-8 | |
79 | Pakiet zawierający przykładowe programy napisane w języku Cython. | |
80 | ||
81 | %prep | |
82 | %setup -q -n %{module}-%{version} | |
83 | ||
84 | %build | |
85 | %if %{with python2} | |
86 | CC="%{__cc}" \ | |
87 | CFLAGS="%{rpmcflags}" \ | |
88 | %{__python} setup.py build \ | |
89 | --build-base build-2 | |
90 | %endif | |
91 | ||
92 | %if %{with python3} | |
93 | CC="%{__cc}" \ | |
94 | CFLAGS="%{rpmcflags}" \ | |
95 | %{__python3} setup.py build \ | |
96 | --build-base build-3 | |
97 | %endif | |
98 | ||
99 | %install | |
100 | rm -rf $RPM_BUILD_ROOT | |
101 | install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} | |
102 | ||
103 | %if %{with python3} | |
104 | %{__python3} setup.py \ | |
105 | build \ | |
106 | --build-base build-3 \ | |
107 | install \ | |
108 | --optimize=2 \ | |
109 | --skip-build \ | |
110 | --root=$RPM_BUILD_ROOT | |
111 | ||
112 | %{__mv} $RPM_BUILD_ROOT%{_bindir}/cython{,3} | |
113 | %{__mv} $RPM_BUILD_ROOT%{_bindir}/cythonize{,3} | |
114 | %{__mv} $RPM_BUILD_ROOT%{_bindir}/cygdb{,3} | |
115 | %endif | |
116 | ||
117 | %if %{with python2} | |
118 | %{__python} setup.py \ | |
119 | build \ | |
120 | --build-base build-2 \ | |
121 | install \ | |
122 | --optimize=2 \ | |
123 | --skip-build \ | |
124 | --root=$RPM_BUILD_ROOT | |
125 | ||
126 | find $RPM_BUILD_ROOT%{py_sitedir} -name "*.py" -a ! -name 'Lexicon.py' -exec rm -f {} \; | |
127 | %endif | |
128 | ||
129 | cp -a Demos/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} | |
130 | ||
131 | %clean | |
132 | rm -rf $RPM_BUILD_ROOT | |
133 | ||
134 | %if %{with python2} | |
135 | %files | |
136 | %defattr(644,root,root,755) | |
137 | %doc COPYING.txt README.txt ToDo.txt USAGE.txt Doc/*.html Doc/*.c | |
138 | %attr(755,root,root) %{_bindir}/cython | |
139 | %attr(755,root,root) %{_bindir}/cythonize | |
140 | %attr(755,root,root) %{_bindir}/cygdb | |
141 | %{py_sitedir}/cython.py[co] | |
142 | %{py_sitedir}/Cython | |
143 | %{py_sitedir}/pyximport | |
144 | %{py_sitedir}/Cython-%{version}-py*.egg-info | |
145 | %endif | |
146 | ||
147 | %if %{with python3} | |
148 | %files -n python3-Cython | |
149 | %defattr(644,root,root,755) | |
150 | %doc COPYING.txt README.txt ToDo.txt USAGE.txt Doc/*.html Doc/*.c | |
151 | %attr(755,root,root) %{_bindir}/cython3 | |
152 | %attr(755,root,root) %{_bindir}/cythonize3 | |
153 | %attr(755,root,root) %{_bindir}/cygdb3 | |
154 | %{py3_sitedir}/cython.py | |
155 | %{py3_sitedir}/__pycache__/cython.* | |
156 | %{py3_sitedir}/Cython | |
157 | %{py3_sitedir}/pyximport | |
158 | %{py3_sitedir}/Cython-%{version}-py*.egg-info | |
159 | %endif | |
160 | ||
161 | %files examples | |
162 | %defattr(644,root,root,755) | |
163 | %{_examplesdir}/%{name}-%{version} |