Пример #1
0
def try_rebuild():
    from pypy.jit.backend import detect_cpu
    model = detect_cpu.autodetect_main_model_and_size()
    # remove the files '_*_model_.py'
    left = {}
    for p in os.listdir(_dirpath):
        if p.startswith('_') and (p.endswith('_%s_.py' % model)
                                  or p.endswith('_%s_.pyc' % model)):
            os.unlink(os.path.join(_dirpath, p))
        elif p.startswith('_') and (p.endswith('_.py') or p.endswith('_.pyc')):
            for i in range(2, len(p) - 4):
                left[p[:i]] = True
    # remove the files '_*_cache.py' if there is no '_*_*_.py' left around
    for p in os.listdir(_dirpath):
        if p.startswith('_') and (p.endswith('_cache.py')
                                  or p.endswith('_cache.pyc')):
            if p[:-9] not in left:
                os.unlink(os.path.join(_dirpath, p))
    #
    for p in os.listdir(_dirpath):
        if p.endswith('.ctc.py'):
            try:
                rebuild_one(p)
            except Exception, e:
                log.ERROR("Running %s:\n  %s: %s" %
                          (os.path.join(_dirpath, p), e.__class__.__name__, e))
Пример #2
0
def try_rebuild():
    from pypy.jit.backend import detect_cpu
    model = detect_cpu.autodetect_main_model_and_size()
    # remove the files '_*_model_.py'
    left = {}
    for p in os.listdir(_dirpath):
        if p.startswith('_') and (p.endswith('_%s_.py' % model) or
                                  p.endswith('_%s_.pyc' % model)):
            os.unlink(os.path.join(_dirpath, p))
        elif p.startswith('_') and (p.endswith('_.py') or
                                    p.endswith('_.pyc')):
            for i in range(2, len(p)-4):
                left[p[:i]] = True
    # remove the files '_*_cache.py' if there is no '_*_*_.py' left around
    for p in os.listdir(_dirpath):
        if p.startswith('_') and (p.endswith('_cache.py') or
                                  p.endswith('_cache.pyc')):
            if p[:-9] not in left:
                os.unlink(os.path.join(_dirpath, p))
    #
    for p in os.listdir(_dirpath):
        if p.endswith('.ctc.py'):
            try:
                rebuild_one(p)
            except Exception, e:
                log.ERROR("Running %s:\n  %s: %s" % (
                    os.path.join(_dirpath, p),
                    e.__class__.__name__, e))
Пример #3
0
    def setup_after_space_initialization(self):
        """NOT_RPYTHON"""
        if not self.space.config.translating:
            self.extra_interpdef("isfake", "interp_magic.isfake")
            self.extra_interpdef("interp_pdb", "interp_magic.interp_pdb")
        if self.space.config.objspace.std.withmethodcachecounter:
            self.extra_interpdef("method_cache_counter", "interp_magic.method_cache_counter")
            self.extra_interpdef("reset_method_cache_counter", "interp_magic.reset_method_cache_counter")
            if self.space.config.objspace.std.withmapdict:
                self.extra_interpdef("mapdict_cache_counter", "interp_magic.mapdict_cache_counter")
        PYC_MAGIC = get_pyc_magic(self.space)
        self.extra_interpdef("PYC_MAGIC", "space.wrap(%d)" % PYC_MAGIC)
        #
        from pypy.jit.backend import detect_cpu

        model = detect_cpu.autodetect_main_model_and_size()
        self.extra_interpdef("cpumodel", "space.wrap(%r)" % model)
Пример #4
0
 def setup_after_space_initialization(self):
     """NOT_RPYTHON"""
     if not self.space.config.translating:
         self.extra_interpdef('isfake', 'interp_magic.isfake')
         self.extra_interpdef('interp_pdb', 'interp_magic.interp_pdb')
     if self.space.config.objspace.std.withmethodcachecounter:
         self.extra_interpdef('method_cache_counter',
                              'interp_magic.method_cache_counter')
         self.extra_interpdef('reset_method_cache_counter',
                              'interp_magic.reset_method_cache_counter')
         if self.space.config.objspace.std.withmapdict:
             self.extra_interpdef('mapdict_cache_counter',
                                  'interp_magic.mapdict_cache_counter')
     PYC_MAGIC = get_pyc_magic(self.space)
     self.extra_interpdef('PYC_MAGIC', 'space.wrap(%d)' % PYC_MAGIC)
     #
     from pypy.jit.backend import detect_cpu
     model = detect_cpu.autodetect_main_model_and_size()
     self.extra_interpdef('cpumodel', 'space.wrap(%r)' % model)
Пример #5
0
 def setup_after_space_initialization(self):
     """NOT_RPYTHON"""
     if not self.space.config.translating:
         self.extra_interpdef('isfake', 'interp_magic.isfake')
         self.extra_interpdef('interp_pdb', 'interp_magic.interp_pdb')
     if self.space.config.objspace.std.withmethodcachecounter:
         self.extra_interpdef('method_cache_counter',
                              'interp_magic.method_cache_counter')
         self.extra_interpdef('reset_method_cache_counter',
                              'interp_magic.reset_method_cache_counter')
         if self.space.config.objspace.std.withmapdict:
             self.extra_interpdef('mapdict_cache_counter',
                                  'interp_magic.mapdict_cache_counter')
     PYC_MAGIC = get_pyc_magic(self.space)
     self.extra_interpdef('PYC_MAGIC', 'space.wrap(%d)' % PYC_MAGIC)
     #
     from pypy.jit.backend import detect_cpu
     model = detect_cpu.autodetect_main_model_and_size()
     self.extra_interpdef('cpumodel', 'space.wrap(%r)' % model)
Пример #6
0
def dumpcache2(basename, config):
    model = detect_cpu.autodetect_main_model_and_size()
    filename = '_%s_%s_.py' % (basename, model)
    dumpcache.dumpcache(__file__, filename, config)
    #
    filename = os.path.join(os.path.dirname(__file__),
                            '_%s_cache.py' % (basename, ))
    g = open(filename, 'w')
    print >> g, '''\
try:
    from __pypy__ import cpumodel
except ImportError:
    from pypy.jit.backend import detect_cpu
    cpumodel = detect_cpu.autodetect_main_model_and_size()
# XXX relative import, should be removed together with
# XXX the relative imports done e.g. by lib_pypy/pypy_test/test_hashlib
mod = __import__("_%s_%%s_" %% (cpumodel,),
                 globals(), locals(), ["*"])
globals().update(mod.__dict__)\
''' % (basename, )
    g.close()
Пример #7
0
def dumpcache2(basename, config):
    model = detect_cpu.autodetect_main_model_and_size()
    filename = '_%s_%s_.py' % (basename, model)
    dumpcache.dumpcache(__file__, filename, config)
    #
    filename = os.path.join(os.path.dirname(__file__),
                            '_%s_cache.py' % (basename,))
    g = open(filename, 'w')
    print >> g, '''\
try:
    from __pypy__ import cpumodel
except ImportError:
    from pypy.jit.backend import detect_cpu
    cpumodel = detect_cpu.autodetect_main_model_and_size()
# XXX relative import, should be removed together with
# XXX the relative imports done e.g. by lib_pypy/pypy_test/test_hashlib
mod = __import__("_%s_%%s_" %% (cpumodel,),
                 globals(), locals(), ["*"])
globals().update(mod.__dict__)\
''' % (basename,)
    g.close()
Пример #8
0
try:
    from __pypy__ import cpumodel
except ImportError:
    from pypy.jit.backend import detect_cpu
    cpumodel = detect_cpu.autodetect_main_model_and_size()
# XXX relative import, should be removed together with
# XXX the relative imports done e.g. by lib_pypy/pypy_test/test_hashlib
mod = __import__("_pyexpat_%s_" % (cpumodel,),
                 globals(), locals(), ["*"])
globals().update(mod.__dict__)
Пример #9
0
try:
    from __pypy__ import cpumodel
except ImportError:
    from pypy.jit.backend import detect_cpu
    cpumodel = detect_cpu.autodetect_main_model_and_size()
# XXX relative import, should be removed together with
# XXX the relative imports done e.g. by lib_pypy/pypy_test/test_hashlib
mod = __import__("_locale_%s_" % (cpumodel, ), globals(), locals(), ["*"])
globals().update(mod.__dict__)