def install(debug=None, trace=False): global __debug global __trace global __dprint_method if debug: __debug = True if trace: __trace = trace try: gc.set_threshold(128) except NotImplementedError: pass if allow_system_packages: dprint('Install pupyimporter + local packages') sys.path_hooks.append(PupyPackageFinder) sys.path.append('pupy://') else: dprint('Install pupyimporter - standalone') del sys.meta_path[:] del sys.path[:] del sys.path_hooks[:] sys.path_hooks = [PupyPackageFinder] sys.path.append('pupy://') sys.path_importer_cache.clear() import platform platform._syscmd_uname = lambda *args, **kwargs: '' platform.architecture = lambda *args, **kwargs: ( '32bit' if pupy.get_arch() == 'x86' else '64bit', '') if __debug__: try: if __trace: __trace = __import__('tracemalloc') if __debug and __trace: dprint('tracemalloc enabled') __trace.start(10) except Exception, e: dprint('tracemalloc init failed: {}'.format(e)) __trace = None
def install(debug=None, trace=False): global __debug global __trace global modules #if debug: # __debug = True if trace: __trace = trace gc.set_threshold(128) if allow_system_packages: sys.path_hooks.append(PupyPackageFinder) sys.path.append('pupy://') else: sys.meta_path = [] sys.path = [] sys.path_hooks = [] sys.path_hooks = [PupyPackageFinder] sys.path.append('pupy://') sys.path_importer_cache.clear() import platform platform._syscmd_uname = lambda *args, **kwargs: '' platform.architecture = lambda *args, **kwargs: ( '32bit' if pupy.get_arch() == 'x86' else '64bit', '' ) try: if __trace: __trace = __import__('tracemalloc') if __debug and __trace: dprint('tracemalloc enabled') __trace.start(10) except Exception, e: dprint('tracemalloc init failed: {}'.format(e)) __trace = None
def install(debug=None, trace=False): global __debug global __trace global modules #if debug: # __debug = True if trace: __trace = trace gc.set_threshold(128) if allow_system_packages: sys.path_hooks.append(PupyPackageFinder) sys.path.append('pupy://') else: sys.meta_path = [] sys.path = [] sys.path_hooks = [] sys.path_hooks = [PupyPackageFinder] sys.path.append('pupy://') sys.path_importer_cache.clear() import platform platform._syscmd_uname = lambda *args, **kwargs: '' platform.architecture = lambda *args, **kwargs: ( '32bit' if pupy.get_arch() == 'x86' else '64bit', '') try: if __trace: __trace = __import__('tracemalloc') if __debug and __trace: dprint('tracemalloc enabled') __trace.start(10) except Exception as e: dprint('tracemalloc init failed: {}'.format(e)) __trace = None def pupy_make_path(name): if not name: return if 'pupy:' in name: name = name[name.find('pupy:') + 5:] name = os.path.relpath(name) name = '/'.join([ x for x in name.split(os.path.sep) if x and not x in ('.', '..') ]) return name def pupy_find_library(name): dprint('pupy_find_library not implement') def pupy_dlopen(name, *args, **kwargs): dprint('pupy_dlopen not implement') # if sys.platform == 'win32': # import pywintypes if __debug: print 'Bundled modules:' for module in modules.iterkeys(): print '+ {}'.format(module)