(name . bug-guix)(address . bug-guix@gnu.org)
It seems that something in Guix confuses the python-cffi code logic and
makes it "think" the platform should be 'win32', while it is 'linux'.
The errors output is copied below:
Toggle snippet (498 lines)
=================================== FAILURES ===================================
______________________________ test_load_library _______________________________
def test_load_library():
> x = find_and_load_library('c')
c/test_c.py:71:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'c', flags = 2
def find_and_load_library(name, flags=RTLD_NOW):
import ctypes.util
if name is None:
path = None
else:
path = ctypes.util.find_library(name)
if path is None and name == 'c':
> assert sys.platform == 'win32'
E AssertionError: assert 'linux' == 'win32'
E - linux
E + win32
c/test_c.py:65: AssertionError
_________________________ test_load_and_call_function __________________________
def test_load_and_call_function():
BChar = new_primitive_type("char")
BCharP = new_pointer_type(BChar)
BLong = new_primitive_type("long")
BFunc = new_function_type((BCharP,), BLong, False)
> ll = find_and_load_library('c')
c/test_c.py:1204:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'c', flags = 2
def find_and_load_library(name, flags=RTLD_NOW):
import ctypes.util
if name is None:
path = None
else:
path = ctypes.util.find_library(name)
if path is None and name == 'c':
> assert sys.platform == 'win32'
E AssertionError: assert 'linux' == 'win32'
E - linux
E + win32
c/test_c.py:65: AssertionError
______________________________ test_read_variable ______________________________
def test_read_variable():
## FIXME: this test assumes glibc specific behavior, it's not compliant with C standard
## https://bugs.pypy.org/issue1643
if not sys.platform.startswith("linux"):
py.test.skip("untested")
BVoidP = new_pointer_type(new_void_type())
> ll = find_and_load_library('c')
c/test_c.py:1221:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'c', flags = 2
def find_and_load_library(name, flags=RTLD_NOW):
import ctypes.util
if name is None:
path = None
else:
path = ctypes.util.find_library(name)
if path is None and name == 'c':
> assert sys.platform == 'win32'
E AssertionError: assert 'linux' == 'win32'
E - linux
E + win32
c/test_c.py:65: AssertionError
__________________ test_read_variable_as_unknown_length_array __________________
def test_read_variable_as_unknown_length_array():
## FIXME: this test assumes glibc specific behavior, it's not compliant with C standard
## https://bugs.pypy.org/issue1643
if not sys.platform.startswith("linux"):
py.test.skip("untested")
BCharP = new_pointer_type(new_primitive_type("char"))
BArray = new_array_type(BCharP, None)
> ll = find_and_load_library('c')
c/test_c.py:1232:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'c', flags = 2
def find_and_load_library(name, flags=RTLD_NOW):
import ctypes.util
if name is None:
path = None
else:
path = ctypes.util.find_library(name)
if path is None and name == 'c':
> assert sys.platform == 'win32'
E AssertionError: assert 'linux' == 'win32'
E - linux
E + win32
c/test_c.py:65: AssertionError
_____________________________ test_write_variable ______________________________
def test_write_variable():
## FIXME: this test assumes glibc specific behavior, it's not compliant with C standard
## https://bugs.pypy.org/issue1643
if not sys.platform.startswith("linux"):
py.test.skip("untested")
BVoidP = new_pointer_type(new_void_type())
> ll = find_and_load_library('c')
c/test_c.py:1243:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'c', flags = 2
def find_and_load_library(name, flags=RTLD_NOW):
import ctypes.util
if name is None:
path = None
else:
path = ctypes.util.find_library(name)
if path is None and name == 'c':
> assert sys.platform == 'win32'
E AssertionError: assert 'linux' == 'win32'
E - linux
E + win32
c/test_c.py:65: AssertionError
__________________________________ test_FILE ___________________________________
def test_FILE():
if sys.platform == "win32":
py.test.skip("testing FILE not implemented")
#
BFILE = new_struct_type("struct _IO_FILE")
BFILEP = new_pointer_type(BFILE)
BChar = new_primitive_type("char")
BCharP = new_pointer_type(BChar)
BInt = new_primitive_type("int")
BFunc = new_function_type((BCharP, BFILEP), BInt, False)
BFunc2 = new_function_type((BFILEP, BCharP), BInt, True)
> ll = find_and_load_library('c')
c/test_c.py:2931:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'c', flags = 2
def find_and_load_library(name, flags=RTLD_NOW):
import ctypes.util
if name is None:
path = None
else:
path = ctypes.util.find_library(name)
if path is None and name == 'c':
> assert sys.platform == 'win32'
E AssertionError: assert 'linux' == 'win32'
E - linux
E + win32
c/test_c.py:65: AssertionError
_________________________ test_FILE_only_for_FILE_arg __________________________
def test_FILE_only_for_FILE_arg():
if sys.platform == "win32":
py.test.skip("testing FILE not implemented")
#
B_NOT_FILE = new_struct_type("struct NOT_FILE")
B_NOT_FILEP = new_pointer_type(B_NOT_FILE)
BChar = new_primitive_type("char")
BCharP = new_pointer_type(BChar)
BInt = new_primitive_type("int")
BFunc = new_function_type((BCharP, B_NOT_FILEP), BInt, False)
> ll = find_and_load_library('c')
c/test_c.py:2962:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'c', flags = 2
def find_and_load_library(name, flags=RTLD_NOW):
import ctypes.util
if name is None:
path = None
else:
path = ctypes.util.find_library(name)
if path is None and name == 'c':
> assert sys.platform == 'win32'
E AssertionError: assert 'linux' == 'win32'
E - linux
E + win32
c/test_c.py:65: AssertionError
_______________________________ test_FILE_object _______________________________
def test_FILE_object():
if sys.platform == "win32":
py.test.skip("testing FILE not implemented")
#
BFILE = new_struct_type("FILE")
BFILEP = new_pointer_type(BFILE)
BChar = new_primitive_type("char")
BCharP = new_pointer_type(BChar)
BInt = new_primitive_type("int")
BFunc = new_function_type((BCharP, BFILEP), BInt, False)
BFunc2 = new_function_type((BFILEP,), BInt, False)
> ll = find_and_load_library('c')
c/test_c.py:2986:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'c', flags = 2
def find_and_load_library(name, flags=RTLD_NOW):
import ctypes.util
if name is None:
path = None
else:
path = ctypes.util.find_library(name)
if path is None and name == 'c':
> assert sys.platform == 'win32'
E AssertionError: assert 'linux' == 'win32'
E - linux
E + win32
c/test_c.py:65: AssertionError
_______________________________ TestFFI.test_sin _______________________________
self = <testing.cffi0.test_ffi_backend.TestFFI object at 0x7ffff579b4e0>
def test_sin(self):
ffi = FFI(backend=self.Backend())
ffi.cdef("""
double sin(double x);
""")
> m = ffi.dlopen(lib_m)
testing/cffi0/test_function.py:31:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cffi/api.py:141: in dlopen
lib, function_cache = _make_ffi_library(self, name, flags)
cffi/api.py:802: in _make_ffi_library
backendlib = _load_backend_lib(backend, libname, flags)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
backend = <module '_cffi_backend' from '/tmp/guix-build-python-cffi-1.11.5.drv-0/cffi-1.11.5/build/lib.linux-x86_64-3.7/_cffi_backend.cpython-37m-x86_64-linux-gnu.so'>
name = 'm', flags = 0
def _load_backend_lib(backend, name, flags):
import os
if name is None:
if sys.platform != "win32":
return backend.load_library(None, flags)
name = "c" # Windows: load_library(None) fails, but this works
# on Python 2 (backward compatibility hack only)
first_error = None
if '.' in name or '/' in name or os.sep in name:
try:
return backend.load_library(name, flags)
except OSError as e:
first_error = e
import ctypes.util
path = ctypes.util.find_library(name)
if path is None:
if name == "c" and sys.platform == "win32" and sys.version_info >= (3,):
raise OSError("dlopen(None) cannot work on Windows for Python 3 "
"(see http://bugs.python.org/issue23606)")
msg = ("ctypes.util.find_library() did not manage "
"to locate a library called %r" % (name,))
if first_error is not None:
msg = "%s. Additionally, %s" % (first_error, msg)
> raise OSError(msg)
E OSError: ctypes.util.find_library() did not manage to locate a library called 'm'
cffi/api.py:797: OSError
______________________________ TestFFI.test_sinf _______________________________
self = <testing.cffi0.test_ffi_backend.TestFFI object at 0x7ffff5ef0128>
def test_sinf(self):
if sys.platform == 'win32':
py.test.skip("no sinf found in the Windows stdlib")
ffi = FFI(backend=self.Backend())
ffi.cdef("""
float sinf(float x);
""")
> m = ffi.dlopen(lib_m)
testing/cffi0/test_function.py:42:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cffi/api.py:141: in dlopen
lib, function_cache = _make_ffi_library(self, name, flags)
cffi/api.py:802: in _make_ffi_library
backendlib = _load_backend_lib(backend, libname, flags)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
backend = <module '_cffi_backend' from '/tmp/guix-build-python-cffi-1.11.5.drv-0/cffi-1.11.5/build/lib.linux-x86_64-3.7/_cffi_backend.cpython-37m-x86_64-linux-gnu.so'>
name = 'm', flags = 0
def _load_backend_lib(backend, name, flags):
import os
if name is None:
if sys.platform != "win32":
return backend.load_library(None, flags)
name = "c" # Windows: load_library(None) fails, but this works
# on Python 2 (backward compatibility hack only)
first_error = None
if '.' in name or '/' in name or os.sep in name:
try:
return backend.load_library(name, flags)
except OSError as e:
first_error = e
import ctypes.util
path = ctypes.util.find_library(name)
if path is None:
if name == "c" and sys.platform == "win32" and sys.version_info >= (3,):
raise OSError("dlopen(None) cannot work on Windows for Python 3 "
"(see http://bugs.python.org/issue23606)")
msg = ("ctypes.util.find_library() did not manage "
"to locate a library called %r" % (name,))
if first_error is not None:
msg = "%s. Additionally, %s" % (first_error, msg)
> raise OSError(msg)
E OSError: ctypes.util.find_library() did not manage to locate a library called 'm'
cffi/api.py:797: OSError
_____________________ TestFFI.test_lround_no_return_value ______________________
self = <testing.cffi0.test_ffi_backend.TestFFI object at 0x7ffff5cb2eb8>
def test_lround_no_return_value(self):
# check that 'void'-returning functions work too
ffi = FFI(backend=self.Backend())
ffi.cdef("""
void lround(double x);
""")
> m = ffi.dlopen(lib_m)
testing/cffi0/test_function.py:54:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cffi/api.py:141: in dlopen
lib, function_cache = _make_ffi_library(self, name, flags)
cffi/api.py:802: in _make_ffi_library
backendlib = _load_backend_lib(backend, libname, flags)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
backend = <module '_cffi_backend' from '/tmp/guix-build-python-cffi-1.11.5.drv-0/cffi-1.11.5/build/lib.linux-x86_64-3.7/_cffi_backend.cpython-37m-x86_64-linux-gnu.so'>
name = 'm', flags = 0
def _load_backend_lib(backend, name, flags):
import os
if name is None:
if sys.platform != "win32":
return backend.load_library(None, flags)
name = "c" # Windows: load_library(None) fails, but this works
# on Python 2 (backward compatibility hack only)
first_error = None
if '.' in name or '/' in name or os.sep in name:
try:
return backend.load_library(name, flags)
except OSError as e:
first_error = e
import ctypes.util
path = ctypes.util.find_library(name)
if path is None:
if name == "c" and sys.platform == "win32" and sys.version_info >= (3,):
raise OSError("dlopen(None) cannot work on Windows for Python 3 "
"(see http://bugs.python.org/issue23606)")
msg = ("ctypes.util.find_library() did not manage "
"to locate a library called %r" % (name,))
if first_error is not None:
msg = "%s. Additionally, %s" % (first_error, msg)
> raise OSError(msg)
E OSError: ctypes.util.find_library() did not manage to locate a library called 'm'
cffi/api.py:797: OSError
__________________________ TestFFI.test_dlopen_flags ___________________________
self = <testing.cffi0.test_ffi_backend.TestFFI object at 0x7ffff521bd30>
def test_dlopen_flags(self):
ffi = FFI(backend=self.Backend())
ffi.cdef("""
double cos(double x);
""")
> m = ffi.dlopen(lib_m, ffi.RTLD_LAZY | ffi.RTLD_LOCAL)
testing/cffi0/test_function.py:79:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cffi/api.py:141: in dlopen
lib, function_cache = _make_ffi_library(self, name, flags)
cffi/api.py:802: in _make_ffi_library
backendlib = _load_backend_lib(backend, libname, flags)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
backend = <module '_cffi_backend' from '/tmp/guix-build-python-cffi-1.11.5.drv-0/cffi-1.11.5/build/lib.linux-x86_64-3.7/_cffi_backend.cpython-37m-x86_64-linux-gnu.so'>
name = 'm', flags = 1
def _load_backend_lib(backend, name, flags):
import os
if name is None:
if sys.platform != "win32":
return backend.load_library(None, flags)
name = "c" # Windows: load_library(None) fails, but this works
# on Python 2 (backward compatibility hack only)
first_error = None
if '.' in name or '/' in name or os.sep in name:
try:
return backend.load_library(name, flags)
except OSError as e:
first_error = e
import ctypes.util
path = ctypes.util.find_library(name)
if path is None:
if name == "c" and sys.platform == "win32" and sys.version_info >= (3,):
raise OSError("dlopen(None) cannot work on Windows for Python 3 "
"(see http://bugs.python.org/issue23606)")
msg = ("ctypes.util.find_library() did not manage "
"to locate a library called %r" % (name,))
if first_error is not None:
msg = "%s. Additionally, %s" % (first_error, msg)
> raise OSError(msg)
E OSError: ctypes.util.find_library() did not manage to locate a library called 'm'
cffi/api.py:797: OSError
_________________________ TestFFI.test_dlopen_constant _________________________
self = <testing.cffi0.test_ffi_backend.TestFFI object at 0x7ffff579b978>
def test_dlopen_constant(self):
ffi = FFI(backend=self.Backend())
ffi.cdef("""
#define FOOBAR 42
static const float baz = 42.5; /* not visible */
double sin(double x);
""")
> m = ffi.dlopen(lib_m)
testing/cffi0/test_function.py:90:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cffi/api.py:141: in dlopen
lib, function_cache = _make_ffi_library(self, name, flags)
cffi/api.py:802: in _make_ffi_library
backendlib = _load_backend_lib(backend, libname, flags)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
backend = <module '_cffi_backend' from '/tmp/guix-build-python-cffi-1.11.5.drv-0/cffi-1.11.5/build/lib.linux-x86_64-3.7/_cffi_backend.cpython-37m-x86_64-linux-gnu.so'>
name = 'm', flags = 0
def _load_backend_lib(backend, name, flags):
import os
if name is None:
if sys.platform != "win32":
return backend.load_library(None, flags)
name = "c" # Windows: load_library(None) fails, but this works
# on Python 2 (backward compatibility hack only)
first_error = None
if '.' in name or '/' in name or os.sep in name:
try:
return backend.load_library(name, flags)
except OSError as e:
first_error = e
import ctypes.util
path = ctypes.util.find_library(name)
if path is None:
if name == "c" and sys.platform == "win32" and sys.version_info >= (3,):
raise OSError("dlopen(None) cannot work on Windows for Python 3 "
"(see http://bugs.python.org/issue23606)")
msg = ("ctypes.util.find_library() did not manage "
"to locate a library called %r" % (name,))
if first_error is not None:
msg = "%s. Additionally, %s" % (first_error, msg)
> raise OSError(msg)
E OSError: ctypes.util.find_library() did not manage to locate a library called 'm'
cffi/api.py:797: OSError
________________________ TestFFI.test_function_typedef _________________________
self = <testing.cffi0.test_ffi_backend.TestFFI object at 0x7ffff5bdbef0>
def test_function_typedef(self):
ffi = FFI(backend=self.Backend())
ffi.cdef("""
typedef double func_t(double);
func_t sin;
""")
> m = ffi.dlopen(lib_m)
testing/cffi0/test_function.py:300:
This message was truncated. Download the full message here.