Matej Cepl 2018-10-17 15:11:53 +00:00 committed by Git OBS Bridge
parent 85c14cfd92
commit 2135b5caf7
3 changed files with 25 additions and 1 deletions

View File

@ -26,6 +26,8 @@ Group: Development/Languages/Python
URL: http://cffi.readthedocs.org
Source0: https://files.pythonhosted.org/packages/source/c/cffi/cffi-%{version}.tar.gz
Source1: python-cffi-rpmlintrc
Source2: test_cos_01.py
Source3: test_cos_02.py
# https://bitbucket.org/cffi/cffi/issues/384/
Patch0: e2e324a2f13e3a646de6f6ff03e90ed7d37e2636.patch
# https://bitbucket.org/cffi/cffi/issues/378
@ -50,6 +52,9 @@ is to provide a convenient and reliable way of calling C code from Python.
%setup -q -n cffi-%{version}
%autopatch -p1
cp -v -p %{SOURCE2} .
cp -v -p %{SOURCE3} .
%build
export CFLAGS="%{optflags}"
%python_build
@ -59,7 +64,14 @@ export CFLAGS="%{optflags}"
%python_expand %fdupes %{buildroot}%{$python_sitearch}
%check
%python_expand PYTHONPATH=%{buildroot}%{$python_sitearch} py.test-%$python_bin_suffix -W ignore::UserWarning c/ testing/
# https://bitbucket.org/cffi/cffi/issues/390/
%{python_expand PYTHONPATH=%{buildroot}%{$python_sitearch}
py.test-%$python_bin_suffix -k test_dlopen_filename -W ignore::UserWarning c/ testing/
echo "Testing test_cos_01.py"
%python_exec test_cos_01.py
echo "Testing test_cos_02.py"
%python_exec test_cos_02.py
}
%files %{python_files}
%license LICENSE

6
test_cos_01.py Normal file
View File

@ -0,0 +1,6 @@
import cffi, ctypes.util
ctypes.util.find_library('m')
ffi = cffi.FFI()
ffi.cdef("double cos(double);")
print(ffi.dlopen('m').cos(1.23))
print(ffi.dlopen('libm.so.6').cos(1.23))

6
test_cos_02.py Normal file
View File

@ -0,0 +1,6 @@
import cffi, ctypes.util
ctypes.util.find_library('m')
ffi = cffi.FFI()
ffi.cdef("double cos(double);")
print(ffi.dlopen('libm.so.6').cos(1.23))
print(ffi.dlopen('m').cos(1.23))