Commits

Manuel Jacob  committed dc93c3f Merge

hg merge default

  • Participants
  • Parent commits 12bca02, 97989d1
  • Branches py3k

Comments (0)

Files changed (6)

File pypy/goal/getnightly.py

     arch = 'linux'
     cmd = 'wget "%s"'
     tar = "tar -x -v --wildcards --strip-components=2 -f %s '*/bin/pypy'"
-if sys.platform.startswith('darwin'):
+    if os.uname()[-1].startswith('arm'):
+        arch += '-armhf-raspbian'
+elif sys.platform.startswith('darwin'):
     arch = 'osx'
     cmd = 'curl -O "%s"'
     tar = "tar -x -v --strip-components=2 -f %s '*/bin/pypy'"

File pypy/goal/targetpypystandalone.py

 
 import os, sys
 
+import pypy
 from pypy.interpreter import gateway
 from pypy.interpreter.error import OperationError
 from pypy.tool.ann_override import PyPyAnnotatorPolicy
     from rpython.rlib.entrypoint import entrypoint
     from rpython.rtyper.lltypesystem import rffi
 
+    @entrypoint('main', [rffi.CCHARP], c_name='pypy_setup_home')
+    def pypy_setup_home(ll_home):
+        from pypy.module.sys.initpath import pypy_find_stdlib
+        if ll_home:
+            home = rffi.charp2str(ll_home)
+        else:
+            home = pypydir
+        pypy_find_stdlib(space, home)
+        space.startup()
+        # import site
+        try:
+            import_ = space.getattr(space.getbuiltinmodule('__builtin__'),
+                                    space.wrap('__import__'))
+            space.call_function(import_, space.wrap('site'))
+            return 0
+        except OperationError:
+            return 1
+
     @entrypoint('main', [rffi.CCHARP], c_name='pypy_execute_source')
     def pypy_execute_source(ll_source):
         source = rffi.charp2str(ll_source)
             return 1
         return 0
 
-    return entry_point, _pypy_execute_source # for tests
+    return entry_point, {'pypy_execute_source': pypy_execute_source,
+                         'pypy_setup_home': pypy_setup_home}
 
 def call_finish(space):
     space.finish()

File pypy/interpreter/test/test_targetpypy.py

 from pypy.goal.targetpypystandalone import get_entry_point, create_entry_point
 from pypy.config.pypyoption import get_pypy_config
+from rpython.rtyper.lltypesystem import rffi, lltype
 
 class TestTargetPyPy(object):
     def test_run(self):
         entry_point(['pypy-c' , '-S', '-c', 'print 3'])
 
 def test_exeucte_source(space):
-    _, execute_source = create_entry_point(space, None)
-    execute_source("import sys; sys.modules['xyz'] = 3")
+    _, d = create_entry_point(space, None)
+    execute_source = d['pypy_execute_source']
+    lls = rffi.str2charp("import sys; sys.modules['xyz'] = 3")
+    execute_source(lls)
+    lltype.free(lls, flavor='raw')
     x = space.int_w(space.getitem(space.getattr(space.builtin_modules['sys'],
                                                 space.wrap('modules')),
                                                 space.wrap('xyz')))
     assert x == 3
-    execute_source("sys")
+    lls = rffi.str2charp("sys")
+    execute_source(lls)
+    lltype.free(lls, flavor='raw')
     # did not crash - the same globals
+    pypy_setup_home = d['pypy_setup_home']
+    lls = rffi.str2charp(__file__)
+    pypy_setup_home(lls)
+    lltype.free(lls, flavor='raw')

File rpython/rlib/entrypoint.py

                 if not we_are_translated():
                     import traceback
                     traceback.print_exc()
+                    raise
                 else:
                     print str(e)
                     pypy_debug_catch_fatal_exception()

File rpython/translator/c/gcc/test/test_asmgcroot.py

         
         @entrypoint("x42", [lltype.Signed, lltype.Signed], c_name='callback')
         def mycallback(a, b):
-            rffi.stackcounter.stacks_counter += 1
-            llop.gc_stack_bottom(lltype.Void)
             gc.collect()
-            rffi.stackcounter.stacks_counter -= 1
             return a + b
 
         c_source = py.code.Source("""

File rpython/translator/c/genc.py

     print >> f, '/***********************************************************/'
     print >> f, '/***  Structure definitions                              ***/'
     print >> f
+    print >> f, "#ifndef _PYPY_STRUCTDEF_H"
+    print >> f, "#define _PYPY_STRUCTDEF_H"
     for node in structdeflist:
         if hasattr(node, 'forward_decl'):
             if node.forward_decl:
     for node in structdeflist:
         for line in node.definition():
             print >> f, line
+    print >> f, "#endif"
 
 def gen_forwarddecl(f, database):
     print >> f, '/***********************************************************/'
     print >> f, '/***  Forward declarations                               ***/'
     print >> f
+    print >> f, "#ifndef _PYPY_FORWARDDECL_H"
+    print >> f, "#define _PYPY_FORWARDDECL_H"
     for node in database.globalcontainers():
         for line in node.forward_declaration():
             print >> f, line
+    print >> f, "#endif"
 
 def gen_preimpl(f, database):
     if database.translator is None or database.translator.rtyper is None: