[pypy-commit] pypy kill-someobject: killed shared pypy
fijal
noreply at buildbot.pypy.org
Mon Oct 8 13:14:55 CEST 2012
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: kill-someobject
Changeset: r57896:92d6a51dfe18
Date: 2012-10-08 13:14 +0200
http://bitbucket.org/pypy/pypy/changeset/92d6a51dfe18/
Log: killed shared pypy
diff --git a/pypy/translator/c/dlltool.py b/pypy/translator/c/dlltool.py
--- a/pypy/translator/c/dlltool.py
+++ b/pypy/translator/c/dlltool.py
@@ -1,5 +1,4 @@
-from pypy.translator.driver import TranslationDriver
from pypy.translator.c.genc import CBuilder
from pypy.rpython.typesystem import getfunctionptr
from pypy.translator.tool.cbuild import ExternalCompilationInfo
@@ -39,18 +38,3 @@
def get_entry_point(self, isolated=False):
return self.so_name
-
-class DLLDef(object):
- def __init__(self, name, functions=[], policy=None, config=None):
- self.name = name
- self.functions = functions # [(function, annotation), ...]
- self.driver = TranslationDriver(config=config)
- self.driver.setup_library(self, policy=policy)
-
- def compile(self):
- self.driver.proceed(['compile_c'])
- return self.driver.c_entryp
-
- def getcbuilder(self, translator, config):
- return CLibraryBuilder(translator, None, config,
- functions=self.functions, name=self.name)
diff --git a/pypy/translator/c/test/test_dlltool.py b/pypy/translator/c/test/test_dlltool.py
deleted file mode 100644
--- a/pypy/translator/c/test/test_dlltool.py
+++ /dev/null
@@ -1,31 +0,0 @@
-
-from pypy.translator.c.dlltool import DLLDef
-from ctypes import CDLL
-import py
-
-class TestDLLTool(object):
- 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
-
- 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('pypy_translator_c_test_test_dlltool.c').check()
diff --git a/pypy/translator/goal/sharedpypy.py b/pypy/translator/goal/sharedpypy.py
deleted file mode 100644
--- a/pypy/translator/goal/sharedpypy.py
+++ /dev/null
@@ -1,58 +0,0 @@
-
-import sys, pdb, traceback
-from pypy.translator.c.dlltool import DLLDef
-from pypy.config.translationoption import get_combined_translation_config
-from pypy.rpython.lltypesystem.rffi import charp2str, CCHARP, VOIDP
-from pypy.tool.option import make_objspace
-from pypy.interpreter.error import OperationError
-from pypy.config.pypyoption import pypy_optiondescription, set_pypy_opt_level
-from pypy.translator.goal.ann_override import PyPyAnnotatorPolicy
-from pypy.config.translationoption import set_opt_level
-from pypy.config.pypyoption import enable_allworkingmodules
-
-OVERRIDES = {
- 'translation.debug': False,
-}
-
-def main(argv):
- config = get_combined_translation_config(pypy_optiondescription,
- overrides=OVERRIDES, translating=True)
- config.objspace.nofaking = True
- config.objspace.compiler = "ast"
- config.translating = True
- set_opt_level(config, '1')
- set_pypy_opt_level(config, '1')
- enable_allworkingmodules(config)
-
- space = make_objspace(config)
- policy = PyPyAnnotatorPolicy(single_space=space)
-
- def interpret(source, context):
- 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)
-
More information about the pypy-commit
mailing list