diff --git a/python-cffi.spec b/python-cffi.spec index 626e2b0..6de9784 100644 --- a/python-cffi.spec +++ b/python-cffi.spec @@ -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 diff --git a/test_cos_01.py b/test_cos_01.py new file mode 100644 index 0000000..216d4f5 --- /dev/null +++ b/test_cos_01.py @@ -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)) diff --git a/test_cos_02.py b/test_cos_02.py new file mode 100644 index 0000000..023f2fc --- /dev/null +++ b/test_cos_02.py @@ -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))