[pypy-commit] pypy default: merged upstream

alex_gaynor noreply at buildbot.pypy.org
Sat Nov 30 22:58:09 CET 2013


Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: 
Changeset: r68349:e797f7673b02
Date: 2013-11-30 15:57 -0600
http://bitbucket.org/pypy/pypy/changeset/e797f7673b02/

Log:	merged upstream

diff --git a/lib_pypy/_pypy_testcapi.py b/lib_pypy/_pypy_testcapi.py
--- a/lib_pypy/_pypy_testcapi.py
+++ b/lib_pypy/_pypy_testcapi.py
@@ -33,14 +33,13 @@
     # set link options
     output_filename = modulename + _get_c_extension_suffix()
     if sys.platform == 'win32':
-        # XXX libpypy-c.lib is currently not installed automatically
-        library = os.path.join(thisdir, '..', 'include', 'libpypy-c')
+        # XXX pyconfig.h uses a pragma to link to the import library,
+        #     which is currently python27.lib
+        library = os.path.join(thisdir, '..', 'include', 'python27')
         if not os.path.exists(library + '.lib'):
-            #For a nightly build
-            library = os.path.join(thisdir, '..', 'include', 'python27')
-        if not os.path.exists(library + '.lib'):
-            # For a local translation
-            library = os.path.join(thisdir, '..', 'pypy', 'goal', 'libpypy-c')
+            # For a local translation or nightly build
+            library = os.path.join(thisdir, '..', 'pypy', 'goal', 'python27')
+        assert os.path.exists(library + '.lib'),'Could not find import library "%s"' % library
         libraries = [library, 'oleaut32']
         extra_ldargs = ['/MANIFEST',  # needed for VC10
                         '/EXPORT:init' + modulename]
diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst
--- a/pypy/doc/whatsnew-head.rst
+++ b/pypy/doc/whatsnew-head.rst
@@ -18,3 +18,7 @@
 
 .. branch: voidtype_strformat
 Better support for record numpy arrays
+
+.. branch: osx-eci-frameworks-makefile
+OSX: Ensure frameworks end up in Makefile when specified in External compilation info
+
diff --git a/pypy/module/_cffi_backend/cdataobj.py b/pypy/module/_cffi_backend/cdataobj.py
--- a/pypy/module/_cffi_backend/cdataobj.py
+++ b/pypy/module/_cffi_backend/cdataobj.py
@@ -424,6 +424,12 @@
     def get_array_length(self):
         return self.length
 
+    def _sizeof(self):
+        from pypy.module._cffi_backend.ctypeptr import W_CTypePtrOrArray
+        ctype = self.ctype
+        assert isinstance(ctype, W_CTypePtrOrArray)
+        return self.length * ctype.ctitem.size
+
 
 class W_CDataHandle(W_CData):
     _attrs_ = ['w_keepalive']
diff --git a/pypy/module/_cffi_backend/test/_backend_test_c.py b/pypy/module/_cffi_backend/test/_backend_test_c.py
--- a/pypy/module/_cffi_backend/test/_backend_test_c.py
+++ b/pypy/module/_cffi_backend/test/_backend_test_c.py
@@ -3125,6 +3125,12 @@
     py.test.raises(TypeError, "p + cast(new_primitive_type('int'), 42)")
     py.test.raises(TypeError, "p - cast(new_primitive_type('int'), 42)")
 
+def test_sizeof_sliced_array():
+    BInt = new_primitive_type("int")
+    BArray = new_array_type(new_pointer_type(BInt), 10)
+    p = newp(BArray, None)
+    assert sizeof(p[2:9]) == 7 * sizeof(BInt)
+
 
 def test_version():
     # this test is here mostly for PyPy
diff --git a/rpython/config/translationoption.py b/rpython/config/translationoption.py
--- a/rpython/config/translationoption.py
+++ b/rpython/config/translationoption.py
@@ -1,4 +1,5 @@
 import sys
+import os
 from rpython.config.config import OptionDescription, BoolOption, IntOption, ArbitraryOption, FloatOption
 from rpython.config.config import ChoiceOption, StrOption, Config
 from rpython.config.config import ConfigError
@@ -20,6 +21,9 @@
 
 IS_64_BITS = sys.maxint > 2147483647
 
+MAINDIR = os.path.dirname(os.path.dirname(__file__))
+CACHE_DIR = os.path.realpath(os.path.join(MAINDIR, '_cache'))
+
 PLATFORMS = [
     'maemo',
     'host',
diff --git a/rpython/conftest.py b/rpython/conftest.py
--- a/rpython/conftest.py
+++ b/rpython/conftest.py
@@ -5,7 +5,6 @@
 pytest_plugins = 'rpython.tool.pytest.expecttest'
 
 cdir = realpath(join(dirname(__file__), 'translator', 'c'))
-cache_dir = realpath(join(dirname(__file__), '_cache'))
 option = None
 
 def braindead_deindent(self):
diff --git a/rpython/rlib/test/test_rstacklet.py b/rpython/rlib/test/test_rstacklet.py
--- a/rpython/rlib/test/test_rstacklet.py
+++ b/rpython/rlib/test/test_rstacklet.py
@@ -74,8 +74,8 @@
             h = self.sthread.new(switchbackonce_callback,
                                  rffi.cast(llmemory.Address, 321))
             # 'h' ignored
-            if (i % 5000) == 2500:
-                rgc.collect()
+            if (i % 2000) == 1000:
+                rgc.collect()  # This should run in < 1.5GB virtual memory
 
     def any_alive(self):
         for task in self.tasks:
diff --git a/rpython/tool/gcc_cache.py b/rpython/tool/gcc_cache.py
--- a/rpython/tool/gcc_cache.py
+++ b/rpython/tool/gcc_cache.py
@@ -1,15 +1,13 @@
-from rpython.translator.platform import CompilationError
-from rpython.conftest import cache_dir
 from hashlib import md5
 import py, os
 
-cache_dir_root = py.path.local(cache_dir).ensure(dir=1)
-
 def cache_file_path(c_files, eci, cachename):
     "Builds a filename to cache compilation data"
     # Import 'platform' every time, the compiler may have been changed
     from rpython.translator.platform import platform
-    cache_dir = cache_dir_root.join(cachename).ensure(dir=1)
+    from rpython.config.translationoption import CACHE_DIR
+    cache_root = py.path.local(CACHE_DIR).ensure(dir=1)
+    cache_dir = cache_root.join(cachename).ensure(dir=1)
     filecontents = [c_file.read() for c_file in c_files]
     key = repr((filecontents, eci, platform.key()))
     hash = md5(key).hexdigest()
diff --git a/rpython/tool/test/test_gcc_cache.py b/rpython/tool/test/test_gcc_cache.py
--- a/rpython/tool/test/test_gcc_cache.py
+++ b/rpython/tool/test/test_gcc_cache.py
@@ -1,8 +1,11 @@
 import sys
-from rpython.tool.gcc_cache import *
+import cStringIO
+import py
 from rpython.tool.udir import udir
-import md5, cStringIO
 from rpython.translator.tool.cbuild import ExternalCompilationInfo
+from rpython.translator.platform import CompilationError
+from rpython.tool.gcc_cache import (
+    cache_file_path, build_executable_cache, try_compile_cache)
 
 localudir = udir.join('test_gcc_cache').ensure(dir=1)
 
@@ -90,4 +93,3 @@
     finally:
         sys.stderr = oldstderr
     assert 'ERROR' not in capture.getvalue().upper()
-    
diff --git a/rpython/translator/driver.py b/rpython/translator/driver.py
--- a/rpython/translator/driver.py
+++ b/rpython/translator/driver.py
@@ -470,7 +470,8 @@
         return py.path.local(newexename)
 
     def create_exe(self):
-        """ Copy the compiled executable into translator/goal
+        """ Copy the compiled executable into current directory, which is
+            pypy/goal on nightly builds
         """
         if self.exe_name is not None:
             exename = self.c_entryp
@@ -482,8 +483,11 @@
                 shutil.copy(str(soname), str(newsoname))
                 self.log.info("copied: %s" % (newsoname,))
                 if sys.platform == 'win32':
-                    shutil.copyfile(str(soname.new(ext='lib')),
-                                    str(newsoname.new(ext='lib')))
+                    # the import library is named python27.lib, according
+                    # to the pragma in pyconfig.h
+                    libname = str(newsoname.dirpath().join('python27.lib'))
+                    shutil.copyfile(str(soname.new(ext='lib')), libname)
+                    self.log.info("copied: %s" % (libname,))
             self.c_entryp = newexename
         self.log.info('usession directory: %s' % (udir,))
         self.log.info("created: %s" % (self.c_entryp,))
diff --git a/rpython/translator/goal/translate.py b/rpython/translator/goal/translate.py
--- a/rpython/translator/goal/translate.py
+++ b/rpython/translator/goal/translate.py
@@ -7,19 +7,17 @@
 
 import os
 import sys
-from rpython.conftest import cache_dir
-
 import py
-# clean up early rpython/_cache
-try:
-    py.path.local(cache_dir).remove()
-except Exception:
-    pass
-
 from rpython.config.config import (to_optparse, OptionDescription, BoolOption,
     ArbitraryOption, StrOption, IntOption, Config, ChoiceOption, OptHelpFormatter)
 from rpython.config.translationoption import (get_combined_translation_config,
-    set_opt_level, OPT_LEVELS, DEFAULT_OPT_LEVEL, set_platform)
+    set_opt_level, OPT_LEVELS, DEFAULT_OPT_LEVEL, set_platform, CACHE_DIR)
+
+# clean up early rpython/_cache
+try:
+    py.path.local(CACHE_DIR).remove()
+except Exception:
+    pass
 
 
 GOALS = [
diff --git a/rpython/translator/test/test_driver.py b/rpython/translator/test/test_driver.py
--- a/rpython/translator/test/test_driver.py
+++ b/rpython/translator/test/test_driver.py
@@ -1,6 +1,7 @@
 import py
-
+import os
 from rpython.translator.driver import TranslationDriver
+from rpython.tool.udir import udir 
 
 def test_ctr():
     td = TranslationDriver()
@@ -44,3 +45,33 @@
                 'compile_c', 'pyjitpl']
 
     assert set(td.exposed) == set(expected)
+
+
+def test_create_exe():
+    if not os.name == 'nt':
+        py.test.skip('Windows only test')
+
+    dst_name = udir.join('dst/pypy.exe')
+    src_name = udir.join('src/dydy2.exe')
+    dll_name = udir.join('src/pypy.dll')
+    lib_name = udir.join('src/pypy.lib')
+    src_name.ensure()
+    src_name.write('exe')
+    dll_name.ensure()
+    dll_name.write('dll')
+    lib_name.ensure()
+    lib_name.write('lib')
+    dst_name.ensure()
+
+    class CBuilder(object):
+        shared_library_name = dll_name 
+
+    td = TranslationDriver(exe_name=str(dst_name))
+    td.c_entryp = str(src_name)
+    td.cbuilder = CBuilder()
+    td.create_exe()
+    assert dst_name.read() == 'exe'
+    assert dst_name.new(ext='dll').read() == 'dll'
+    assert dst_name.new(purebasename='python27',ext='lib').read() == 'lib'
+
+
diff --git a/testrunner/runner.py b/testrunner/runner.py
--- a/testrunner/runner.py
+++ b/testrunner/runner.py
@@ -159,6 +159,8 @@
             else:
                 msg = "Killed by %s." % getsignalname(-exitcode)
             extralog = "! %s\n %s\n" % (test, msg)
+        else:
+            extralog = "  (somefailed=True in %s)\n" % (test,)
     else:
         failure = False
     return failure, extralog
@@ -261,7 +263,8 @@
         done += 1
         failure = failure or somefailed
 
-        heading = "__ %s [%d done in total] " % (testname, done)
+        heading = "__ %s [%d done in total, somefailed=%s] " % (
+            testname, done, somefailed)
         
         out.write(heading + (79-len(heading))*'_'+'\n')
 
diff --git a/testrunner/test/test_runner.py b/testrunner/test/test_runner.py
--- a/testrunner/test/test_runner.py
+++ b/testrunner/test/test_runner.py
@@ -171,7 +171,7 @@
 
         failure, extralog = runner.interpret_exitcode(1, "test_foo", "F Foo\n")
         assert failure
-        assert extralog == ""
+        assert extralog == "  (somefailed=True in test_foo)\n"
 
         failure, extralog = runner.interpret_exitcode(2, "test_foo")
         assert failure


More information about the pypy-commit mailing list