Exemplo n.º 1
0
def load_pypy_opcode():
    from pypy.tool.lib_pypy import LIB_PYTHON
    opcode_path = LIB_PYTHON.join('opcode.py')
    d = {}
    execfile(str(opcode_path), d)
    for name in __all__:
        if name in d:
            globals()[name] = d[name]
    return d
Exemplo n.º 2
0
def load_pypy_opcode():
    from pypy.tool.lib_pypy import LIB_PYTHON
    opcode_path = LIB_PYTHON.join('opcode.py')
    d = {}
    execfile(str(opcode_path), d)
    for name in __all__:
        if name in d:
            globals()[name] = d[name]
    return d
Exemplo n.º 3
0
import autopath
import os, sys, stat, errno
from pypy.translator.sandbox.pypy_interact import PyPySandboxedProc
from pypy.translator.interactive import Translation

from pypy.module.sys.version import CPYTHON_VERSION
from pypy.tool.lib_pypy import LIB_PYTHON

VERSION = '%d.%d' % CPYTHON_VERSION[:2]
SITE_PY_CONTENT = LIB_PYTHON.join('site.py').read()
ERROR_TEXT = os.strerror(errno.ENOENT)


def assert_(cond, text):
    if not cond:
        print "assert failed:", text
        raise AssertionError


def mini_pypy_like_entry_point(argv):
    """An RPython standalone executable that does the same kind of I/O as
    PyPy when it starts up.
    """
    assert_(len(argv) == 3, "expected len(argv) == 3")
    assert_(argv[1] == 'foo', "bad argv[1]")
    assert_(argv[2] == 'bar', "bad argv[2]")
    env = os.environ.items()
    assert_(len(env) == 0, "empty environment expected")
    assert_(argv[0] == '/bin/pypy-c', "bad argv[0]")
    st = os.lstat('/bin/pypy-c')
    assert_(stat.S_ISREG(st.st_mode), "bad st_mode for /bin/pypy-c")
Exemplo n.º 4
0
import autopath
import os, sys, stat, errno
from pypy.translator.sandbox.pypy_interact import PyPySandboxedProc
from pypy.translator.interactive import Translation

from pypy.module.sys.version import CPYTHON_VERSION
from pypy.tool.lib_pypy import LIB_PYTHON

VERSION = '%d.%d' % CPYTHON_VERSION[:2]
SITE_PY_CONTENT = LIB_PYTHON.join('site.py').read()
ERROR_TEXT = os.strerror(errno.ENOENT)

def assert_(cond, text):
    if not cond:
        print "assert failed:", text
        raise AssertionError

def mini_pypy_like_entry_point(argv):
    """An RPython standalone executable that does the same kind of I/O as
    PyPy when it starts up.
    """
    assert_(len(argv) == 3, "expected len(argv) == 3")
    assert_(argv[1] == 'foo', "bad argv[1]")
    assert_(argv[2] == 'bar', "bad argv[2]")
    env = os.environ.items()
    assert_(len(env) == 0, "empty environment expected")
    assert_(argv[0] == '/bin/pypy-c', "bad argv[0]")
    st = os.lstat('/bin/pypy-c')
    assert_(stat.S_ISREG(st.st_mode), "bad st_mode for /bin/pypy-c")
    for dirname in ['/bin/lib-python/' + VERSION, '/bin/lib_pypy']:
        st = os.stat(dirname)
Exemplo n.º 5
0
def load_module():
    from pypy.tool.lib_pypy import LIB_PYTHON
    module_path = LIB_PYTHON.join('__future__.py')
    execfile(str(module_path), globals())