Example #1
0
    def test_split_criteria(self):
        def f(x):
            return x

        def b(x):
            return x + 2

        d = DLLDef('lib', [(f, [int]), (b, [int])])
        so = d.compile()
        assert py.path.local(so).dirpath().join('implement.c').check()
Example #2
0
    def test_split_criteria(self):
        def f(x):
            return x

        def b(x):
            return x + 2

        d = DLLDef('lib', [(f, [int]), (b, [int])])
        so = d.compile()
        assert py.path.local(so).dirpath().join('implement.c').check()
Example #3
0
    def test_split_criteria(self):
        def f(x):
            return x

        def b(x):
            return x + 2

        d = DLLDef('lib', [(f, [int]), (b, [int])])
        so = d.compile()
        dirpath = py.path.local(so).dirpath()
        assert dirpath.join('translator_c_test_test_dlltool.c').check()
Example #4
0
    def test_split_criteria(self):
        def f(x):
            return x

        def b(x):
            return x + 2

        d = DLLDef('lib', [(f, [int]), (b, [int])])
        so = d.compile()
        dirpath = py.path.local(so).dirpath()
        assert dirpath.join('translator_c_test_test_dlltool.c').check()
Example #5
0
    def test_basic(self):
        def f(x):
            return x

        def b(x):
            return x + 2

        d = DLLDef('lib', [(f, [int]), (b, [int])])
        so = d.compile()
        dll = CDLL(str(so))
        assert dll.f(3) == 3
        assert dll.b(10) == 12
Example #6
0
    def test_basic(self):
        # XXX abusing get_entry_point to get a so name makes no sense
        def f(x):
            return x

        def b(x):
            return x + 2

        d = DLLDef('lib', [(f, [int]), (b, [int])])
        so = d.compile()
        dll = CDLL(str(so))
        assert dll.f(3) == 3
        assert dll.b(10) == 12
Example #7
0
    def test_basic(self):
        # XXX abusing get_entry_point to get a so name makes no sense
        def f(x):
            return x

        def b(x):
            return x + 2

        d = DLLDef('lib', [(f, [int]), (b, [int])])
        so = d.compile()
        dll = CDLL(str(so))
        assert dll.pypy_g_f(3) == 3
        assert dll.pypy_g_b(10) == 12
Example #8
0
        lst = ctx.propertylist(glob.js_val)
        for elem in lst:
            w_val = space.wrap(JSObject(ctx, ctx.get(glob.js_val, elem)))
            space.setitem(w_dict, space.wrap(elem), w_val)
        try:
            ec = space.getexecutioncontext()
            pycode = ec.compiler.compile(source, 'source', 'exec', 0)
            pycode.exec_code(space, w_dict, w_dict)
        except OperationError, e:
            print "OperationError:"
            print " operror-type: " + e.w_type.getname(space, '?')
            print " operror-value: " + space.str_w(space.str(e.w_value))
            return 1
        return 0

    dll = DLLDef('pypylib', [(interpret, [CCHARP, VOIDP])], policy=policy,
                 config=config)
    exe_name = dll.compile()

if __name__ == '__main__':
    try:
        main(sys.argv)
    except KeyboardInterrupt:
        raise
    except:
        e, v, tb = sys.exc_info()
        traceback.print_tb(tb)
        print e, v
        pdb.post_mortem(tb)
        
Example #9
0
        source = charp2str(source)
        w_dict = space.newdict()
        try:
            ec = space.getexecutioncontext()
            pycode = ec.compiler.compile(source, 'source', 'exec', 0)
            pycode.exec_code(space, w_dict, w_dict)
        except OperationError, e:
            print "OperationError:"
            print " operror-type: " + e.w_type.getname(space, '?')
            print " operror-value: " + space.str_w(
                space.str(e.get_w_value(space)))
            return 1
        return 0

    dll = DLLDef('pypylib', [(interpret, [CCHARP, VOIDP])],
                 policy=policy,
                 config=config)
    exe_name = dll.compile()


if __name__ == '__main__':
    try:
        main(sys.argv)
    except KeyboardInterrupt:
        raise
    except:
        e, v, tb = sys.exc_info()
        traceback.print_tb(tb)
        print e, v
        pdb.post_mortem(tb)