]>
Commit | Line | Data |
---|---|---|
a3ed0930 JB |
1 | # |
2 | # Conditional build: | |
5cd26f14 | 3 | %bcond_without python2 # CPython 2.x module |
27fb4448 | 4 | %bcond_with python3 # CPython 3.x module (built from python3-cffi.spec) |
5cd26f14 JB |
5 | %bcond_without doc # Sphinx based documentation |
6 | %bcond_without tests # unit tests | |
a3ed0930 JB |
7 | # |
8 | Summary: Foreign Function Interface for Python 2 calling C code | |
9 | Summary(pl.UTF-8): Interfejs funkcji obcych (FFI) dla Pythona 2 wywołującego kod w C | |
10 | Name: python-cffi | |
27fb4448 | 11 | # keep 1.15.x here for python2 support |
f8370e69 JP |
12 | Version: 1.15.1 |
13 | Release: 2 | |
a3ed0930 JB |
14 | License: MIT |
15 | Group: Libraries/Python | |
5cd26f14 JB |
16 | #Source0Download: https://pypi.org/simple/cffi/ |
17 | Source0: https://files.pythonhosted.org/packages/source/c/cffi/cffi-%{version}.tar.gz | |
f8370e69 | 18 | # Source0-md5: f493860a6e98cd0c4178149568a6b4f6 |
a3ed0930 | 19 | URL: http://cffi.readthedocs.org/ |
2617e1cf JB |
20 | BuildRequires: libffi-devel >= 3 |
21 | BuildRequires: pkgconfig | |
a3ed0930 JB |
22 | %if %{with python2} |
23 | BuildRequires: python >= 1:2.6 | |
24 | BuildRequires: python-devel >= 1:2.6 | |
86550b34 | 25 | BuildRequires: python-setuptools |
5cd26f14 JB |
26 | %if %{with tests} |
27 | BuildRequires: python-pycparser | |
28 | BuildRequires: python-pytest | |
e05ff55a | 29 | BuildRequires: rpm-build >= 4.6 |
2975faee | 30 | BuildRequires: virtualenv |
5cd26f14 | 31 | %endif |
a3ed0930 JB |
32 | %endif |
33 | %if %{with python3} | |
2617e1cf JB |
34 | BuildRequires: python3 >= 1:3.2 |
35 | BuildRequires: python3-devel >= 1:3.2 | |
86550b34 | 36 | BuildRequires: python3-setuptools |
5cd26f14 JB |
37 | %if %{with tests} |
38 | BuildRequires: python3-pycparser | |
39 | BuildRequires: python3-pytest | |
2975faee | 40 | BuildRequires: virtualenv |
5cd26f14 | 41 | %endif |
a3ed0930 | 42 | %endif |
a3ed0930 | 43 | BuildRequires: rpm-pythonprov |
5cd26f14 | 44 | BuildRequires: rpmbuild(macros) >= 1.714 |
2617e1cf | 45 | %{?with_doc:BuildRequires: sphinx-pdg} |
5cd26f14 | 46 | Requires: python-modules >= 1:2.6 |
494e0686 | 47 | Requires: python-pycparser |
a3ed0930 JB |
48 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
49 | ||
50 | %description | |
51 | Foreign Function Interface for Python calling C code. The aim of this | |
52 | project is to provide a convenient and reliable way of calling C code | |
53 | from Python without learning additional language or API. | |
54 | ||
55 | This package contains Python 2 module. | |
56 | ||
57 | %description -l pl.UTF-8 | |
58 | CFFI to interfejs funkcji obcych (FFI - foreign Function Interface) do | |
59 | wywoływania kodu w C z Pythona. Celem projektu jest dostarczenie | |
60 | wygodnego i wiarygodnego sposobu wywoływania kodu w C z Pythona bez | |
61 | potrzeby nauki dodatkowego języka lub API. | |
62 | ||
63 | Ten pakiet zawiera moduł Pythona 2. | |
64 | ||
65 | %package -n python3-cffi | |
66 | Summary: Foreign Function Interface for Python 3 calling C code | |
67 | Summary(pl.UTF-8): Interfejs funkcji obcych (FFI) dla Pythona 3 wywołującego kod w C | |
68 | Group: Libraries/Python | |
5cd26f14 | 69 | Requires: python3-modules >= 1:3.2 |
494e0686 | 70 | Requires: python3-pycparser |
a3ed0930 JB |
71 | |
72 | %description -n python3-cffi | |
73 | Foreign Function Interface for Python calling C code. The aim of this | |
74 | project is to provide a convenient and reliable way of calling C code | |
75 | from Python without learning additional language or API. | |
76 | ||
77 | This package contains Python 3 module. | |
78 | ||
79 | %description -n python3-cffi -l pl.UTF-8 | |
80 | CFFI to interfejs funkcji obcych (FFI - foreign Function Interface) do | |
81 | wywoływania kodu w C z Pythona. Celem projektu jest dostarczenie | |
82 | wygodnego i wiarygodnego sposobu wywoływania kodu w C z Pythona bez | |
83 | potrzeby nauki dodatkowego języka lub API. | |
84 | ||
85 | Ten pakiet zawiera moduł Pythona 3. | |
86 | ||
5cd26f14 JB |
87 | %package apidocs |
88 | Summary: API documentation for Python CFFI module | |
89 | Summary(pl.UTF-8): Dokumentacja API modułu Pythona CFFI | |
90 | Group: Documentation | |
5cd26f14 | 91 | BuildArch: noarch |
5cd26f14 JB |
92 | |
93 | %description apidocs | |
94 | API documentation for Python CFFI module. | |
95 | ||
96 | %description apidocs -l pl.UTF-8 | |
97 | Dokumentacja API modułu Pythona CFFI. | |
98 | ||
a3ed0930 JB |
99 | %prep |
100 | %setup -q -n cffi-%{version} | |
101 | ||
102 | %build | |
103 | %if %{with python2} | |
8084c254 | 104 | %py_build |
5cd26f14 JB |
105 | |
106 | %if %{with tests} | |
2975faee | 107 | PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ |
62cfd150 | 108 | PYTHONPATH=$(pwd):$(echo $(pwd)/build-2/lib.linux-*) \ |
f8370e69 | 109 | %{__python} -m pytest c testing |
5cd26f14 | 110 | %endif |
a3ed0930 | 111 | %endif |
5cd26f14 | 112 | |
a3ed0930 | 113 | %if %{with python3} |
8084c254 | 114 | %py3_build |
5cd26f14 JB |
115 | |
116 | %if %{with tests} | |
2975faee | 117 | PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ |
62cfd150 | 118 | PYTHONPATH=$(pwd):$(echo $(pwd)/build-3/lib.linux-*) \ |
f8370e69 | 119 | %{__python3} -m pytest c testing |
5cd26f14 | 120 | %endif |
a3ed0930 JB |
121 | %endif |
122 | ||
123 | %if %{with doc} | |
124 | %{__make} -C doc html | |
125 | %endif | |
126 | ||
127 | %install | |
128 | rm -rf $RPM_BUILD_ROOT | |
129 | ||
130 | %if %{with python2} | |
8084c254 | 131 | %py_install |
a3ed0930 JB |
132 | |
133 | %py_postclean | |
134 | %endif | |
135 | ||
136 | %if %{with python3} | |
8084c254 | 137 | %py3_install |
a3ed0930 JB |
138 | %endif |
139 | ||
140 | %clean | |
141 | rm -rf $RPM_BUILD_ROOT | |
142 | ||
143 | %if %{with python2} | |
144 | %files | |
145 | %defattr(644,root,root,755) | |
5cd26f14 | 146 | %doc AUTHORS LICENSE README.md |
a3ed0930 JB |
147 | %attr(755,root,root) %{py_sitedir}/_cffi_backend.so |
148 | %dir %{py_sitedir}/cffi | |
5cd26f14 | 149 | %{py_sitedir}/cffi/_cffi_errors.h |
f4001aff | 150 | %{py_sitedir}/cffi/_cffi_include.h |
bf62289b | 151 | %{py_sitedir}/cffi/_embedding.h |
f4001aff | 152 | %{py_sitedir}/cffi/parse_c_type.h |
a3ed0930 JB |
153 | %{py_sitedir}/cffi/*.py[co] |
154 | %{py_sitedir}/cffi-%{version}-py*.egg-info | |
155 | %endif | |
156 | ||
157 | %if %{with python3} | |
158 | %files -n python3-cffi | |
159 | %defattr(644,root,root,755) | |
5cd26f14 | 160 | %doc AUTHORS LICENSE README.md |
a3ed0930 | 161 | %attr(755,root,root) %{py3_sitedir}/_cffi_backend.cpython-*.so |
494e0686 | 162 | %dir %{py3_sitedir}/cffi |
5cd26f14 | 163 | %{py3_sitedir}/cffi/_cffi_errors.h |
f4001aff | 164 | %{py3_sitedir}/cffi/_cffi_include.h |
bf62289b | 165 | %{py3_sitedir}/cffi/_embedding.h |
f4001aff | 166 | %{py3_sitedir}/cffi/parse_c_type.h |
a3ed0930 JB |
167 | %{py3_sitedir}/cffi/*.py |
168 | %{py3_sitedir}/cffi/__pycache__ | |
169 | %{py3_sitedir}/cffi-%{version}-py*.egg-info | |
170 | %endif | |
5cd26f14 JB |
171 | |
172 | %if %{with doc} | |
173 | %files apidocs | |
174 | %defattr(644,root,root,755) | |
175 | %doc doc/build/html/{_static,*.html,*.js} | |
176 | %endif |