[pypy-commit] pypy windows-packaging: merge with default into branch

mattip noreply at buildbot.pypy.org
Mon Nov 18 12:06:54 CET 2013


Author: Matti Picus <matti.picus at gmail.com>
Branch: windows-packaging
Changeset: r68203:7d65e31ab264
Date: 2013-11-18 13:04 +0200
http://bitbucket.org/pypy/pypy/changeset/7d65e31ab264/

Log:	merge with default into branch

diff --git a/lib-python/2.7/test/test_old_mailbox.py b/lib-python/2.7/test/test_old_mailbox.py
--- a/lib-python/2.7/test/test_old_mailbox.py
+++ b/lib-python/2.7/test/test_old_mailbox.py
@@ -73,7 +73,9 @@
         self.createMessage("cur")
         self.mbox = mailbox.Maildir(test_support.TESTFN)
         self.assertTrue(len(self.mbox) == 1)
-        self.assertTrue(self.mbox.next() is not None)
+        msg = self.mbox.next()
+        self.assertTrue(msg is not None)
+        msg.fp.close()
         self.assertTrue(self.mbox.next() is None)
         self.assertTrue(self.mbox.next() is None)
 
@@ -81,7 +83,9 @@
         self.createMessage("new")
         self.mbox = mailbox.Maildir(test_support.TESTFN)
         self.assertTrue(len(self.mbox) == 1)
-        self.assertTrue(self.mbox.next() is not None)
+        msg = self.mbox.next()
+        self.assertTrue(msg is not None)
+        msg.fp.close()
         self.assertTrue(self.mbox.next() is None)
         self.assertTrue(self.mbox.next() is None)
 
@@ -90,8 +94,12 @@
         self.createMessage("new")
         self.mbox = mailbox.Maildir(test_support.TESTFN)
         self.assertTrue(len(self.mbox) == 2)
-        self.assertTrue(self.mbox.next() is not None)
-        self.assertTrue(self.mbox.next() is not None)
+        msg = self.mbox.next()
+        self.assertTrue(msg is not None)
+        msg.fp.close()
+        msg = self.mbox.next()
+        self.assertTrue(msg is not None)
+        msg.fp.close()
         self.assertTrue(self.mbox.next() is None)
         self.assertTrue(self.mbox.next() is None)
 
diff --git a/lib_pypy/_sqlite3.py b/lib_pypy/_sqlite3.py
--- a/lib_pypy/_sqlite3.py
+++ b/lib_pypy/_sqlite3.py
@@ -268,10 +268,18 @@
 if _has_load_extension():
     _ffi.cdef("int sqlite3_enable_load_extension(sqlite3 *db, int onoff);")
 
-_lib = _ffi.verify("""
-#include <sqlite3.h>
-""", libraries=['sqlite3']
-)
+if sys.platform.startswith('freebsd'):
+    _lib = _ffi.verify("""
+    #include <sqlite3.h>
+    """, libraries=['sqlite3'],
+         include_dirs=['/usr/local/include'],
+         library_dirs=['/usr/local/lib']
+    )
+else:
+    _lib = _ffi.verify("""
+    #include <sqlite3.h>
+    """, libraries=['sqlite3']
+    )
 
 exported_sqlite_symbols = [
     'SQLITE_ALTER_TABLE',
diff --git a/pypy/interpreter/test/test_app_main.py b/pypy/interpreter/test/test_app_main.py
--- a/pypy/interpreter/test/test_app_main.py
+++ b/pypy/interpreter/test/test_app_main.py
@@ -942,7 +942,8 @@
 
         self.w_tmp_dir = self.space.wrap(tmp_dir)
 
-        foo_py = prefix.join('foo.py').write("pass")
+        foo_py = prefix.join('foo.py')
+        foo_py.write("pass")
         self.w_foo_py = self.space.wrap(str(foo_py))
 
     def test_setup_bootstrap_path(self):
diff --git a/pypy/module/termios/test/test_termios.py b/pypy/module/termios/test/test_termios.py
--- a/pypy/module/termios/test/test_termios.py
+++ b/pypy/module/termios/test/test_termios.py
@@ -7,6 +7,9 @@
 if os.name != 'posix':
     py.test.skip('termios module only available on unix')
 
+if sys.platform.startswith('freebsd'):
+    raise Exception('XXX seems to hangs on FreeBSD9')
+
 class TestTermios(object):
     def setup_class(cls):
         try:
diff --git a/pypy/module/test_lib_pypy/cffi_tests/test_verify.py b/pypy/module/test_lib_pypy/cffi_tests/test_verify.py
--- a/pypy/module/test_lib_pypy/cffi_tests/test_verify.py
+++ b/pypy/module/test_lib_pypy/cffi_tests/test_verify.py
@@ -1638,7 +1638,11 @@
         #include <malloc.h>
         #define alloca _alloca
         #else
-        #include <alloca.h>
+        # ifdef __FreeBSD__
+        #  include <stdlib.h>
+        # else
+        #  include <alloca.h>
+        # endif
         #endif
         static int (*python_callback)(int how_many, int *values);
         static int c_callback(int how_many, ...) {
diff --git a/pypy/module/test_lib_pypy/pyrepl/__init__.py b/pypy/module/test_lib_pypy/pyrepl/__init__.py
--- a/pypy/module/test_lib_pypy/pyrepl/__init__.py
+++ b/pypy/module/test_lib_pypy/pyrepl/__init__.py
@@ -1,3 +1,6 @@
 import sys
 import lib_pypy.pyrepl
 sys.modules['pyrepl'] = sys.modules['lib_pypy.pyrepl']
+
+if sys.platform.startswith('freebsd'):
+    raise Exception('XXX seems to hangs on FreeBSD9')
diff --git a/pypy/module/test_lib_pypy/test_grp_extra.py b/pypy/module/test_lib_pypy/test_grp_extra.py
--- a/pypy/module/test_lib_pypy/test_grp_extra.py
+++ b/pypy/module/test_lib_pypy/test_grp_extra.py
@@ -16,7 +16,7 @@
             except KeyError:
                 continue
             assert g.gr_gid == 0
-            assert g.gr_mem == ['root'] or g.gr_mem == []
+            assert 'root' in g.gr_mem or g.gr_mem == []
             assert g.gr_name == name
             assert isinstance(g.gr_passwd, str)    # usually just 'x', don't hope :-)
             break
diff --git a/rpython/jit/backend/x86/support.py b/rpython/jit/backend/x86/support.py
--- a/rpython/jit/backend/x86/support.py
+++ b/rpython/jit/backend/x86/support.py
@@ -5,12 +5,13 @@
 
 if WORD == 4:
     extra = ['-DPYPY_X86_CHECK_SSE2']
+    if sys.platform != 'win32':
+        extra += ['-msse2', '-mfpmath=sse']
 else:
-    extra = []
+    extra = []    # the -m options above are always on by default on x86-64
 
 if sys.platform != 'win32':
-    extra = ['-msse2', '-mfpmath=sse',
-             '-DPYPY_CPU_HAS_STANDARD_PRECISION'] + extra
+    extra = ['-DPYPY_CPU_HAS_STANDARD_PRECISION'] + extra
 
 ensure_sse2_floats = rffi.llexternal_use_eci(ExternalCompilationInfo(
     compile_extra = extra,
diff --git a/rpython/jit/backend/x86/test/test_ztranslation_basic.py b/rpython/jit/backend/x86/test/test_ztranslation_basic.py
--- a/rpython/jit/backend/x86/test/test_ztranslation_basic.py
+++ b/rpython/jit/backend/x86/test/test_ztranslation_basic.py
@@ -1,11 +1,11 @@
 from rpython.jit.backend.llsupport.test.ztranslation_test import TranslationTest
-from rpython.translator.translator import TranslationContext
-from rpython.config.translationoption import DEFL_GC
+from rpython.jit.backend.x86.arch import WORD
 
 
 class TestTranslationX86(TranslationTest):
     def _check_cbuilder(self, cbuilder):
         # We assume here that we have sse2.  If not, the CPUClass
         # needs to be changed to CPU386_NO_SSE2, but well.
-        assert '-msse2' in cbuilder.eci.compile_extra
-        assert '-mfpmath=sse' in cbuilder.eci.compile_extra
+        if WORD == 4:
+            assert '-msse2' in cbuilder.eci.compile_extra
+            assert '-mfpmath=sse' in cbuilder.eci.compile_extra
diff --git a/rpython/rlib/rdynload.py b/rpython/rlib/rdynload.py
--- a/rpython/rlib/rdynload.py
+++ b/rpython/rlib/rdynload.py
@@ -4,6 +4,7 @@
 from rpython.rtyper.tool import rffi_platform
 from rpython.rtyper.lltypesystem import rffi
 from rpython.rlib.rarithmetic import r_uint
+from rpython.rlib.objectmodel import we_are_translated
 from rpython.translator.tool.cbuild import ExternalCompilationInfo
 from rpython.translator.platform import platform
 
@@ -79,6 +80,38 @@
     RTLD_NOW = cConfig.RTLD_NOW
     RTLD_LAZY = cConfig.RTLD_LAZY
 
+    _t_opened = {}
+
+    def t_dlopen(name):
+        # for direct execution: can't use the regular way on FreeBSD :-(
+        # http://factor-language.blogspot.de/2009/02/note-about-libdl-functions-on-netbsd.html
+        import ctypes
+        if name:
+            name = rffi.charp2str(name)
+        else:
+            name = None
+        try:
+            res = ctypes.cdll.LoadLibrary(name)
+        except OSError, e:
+            raise DLOpenError(str(e))
+        h = rffi.cast(rffi.VOIDP, res._handle)
+        _t_opened[rffi.cast(rffi.LONG, h)] = res
+        return h
+
+    def t_dlclose(handle):
+        _t_opened.pop(rffi.cast(rffi.LONG, handle))
+        return rffi.cast(rffi.INT, 0)
+
+    def t_dldym(handle, name):
+        import ctypes
+        lib = _t_opened[rffi.cast(rffi.LONG, handle)]
+        try:
+            symbol = lib[name]
+        except AttributeError:
+            raise KeyError(name)
+        res = ctypes.cast(symbol, ctypes.c_void_p)
+        return rffi.cast(rffi.VOIDP, res.value or 0)
+
     def dlerror():
         # XXX this would never work on top of ll2ctypes, because
         # ctypes are calling dlerror itself, unsure if I can do much in this
@@ -91,6 +124,8 @@
     def dlopen(name, mode=-1):
         """ Wrapper around C-level dlopen
         """
+        if not we_are_translated():
+            return t_dlopen(name)
         if mode == -1:
             if RTLD_LOCAL is not None:
                 mode = RTLD_LOCAL
@@ -104,11 +139,16 @@
             raise DLOpenError(err)
         return res
 
-    dlclose = c_dlclose
+    def dlclose(handle):
+        if not we_are_translated():
+            return t_dlclose(handle)
+        return c_dlclose(handle)
 
     def dlsym(libhandle, name):
         """ Wrapper around C-level dlsym
         """
+        if not we_are_translated():
+            return t_dldym(libhandle, name)
         res = c_dlsym(libhandle, name)
         if not res:
             raise KeyError(name)
diff --git a/rpython/rlib/test/test_rdynload.py b/rpython/rlib/test/test_rdynload.py
--- a/rpython/rlib/test/test_rdynload.py
+++ b/rpython/rlib/test/test_rdynload.py
@@ -21,3 +21,4 @@
                            lltype.Signed)), dlsym(lib, 'abs'))
         assert 1 == handle(1)
         assert 1 == handle(-1)
+        dlclose(lib)


More information about the pypy-commit mailing list