Ejemplo n.º 1
0
#
import sys, imp, zlib, marshal

builtin_memimporter = False
try:
    import _memimporter
    builtin_memimporter = True
except ImportError:
    pass

modules = {}
try:
    import pupy
    if not (hasattr(pupy, 'pseudo') and pupy.pseudo):
        modules = marshal.loads(
            zlib.decompress(pupy._get_compressed_library_string()))
except ImportError:
    #modules = marshal.loads(zlib.decompress(open("resources\\library_compressed_string.txt",'rb').read()))
    pass


def get_module_files(fullname):
    """ return the file to load """
    f = fullname.replace(".", "/")
    files = []
    for x in modules.iterkeys():
        if x.rsplit(
                ".", 1
        )[0] == f or f + "/__init__.py" == x or f + "/__init__.pyc" == x:
            files.append(x)
    return files
Ejemplo n.º 2
0
sep = '\\'
if 'linux' in sys.platform:
    sep = '/'

builtin_memimporter=False
try:
    import _memimporter
    builtin_memimporter=True
except ImportError:
    pass

modules={}
try:
    import pupy
    if not (hasattr(pupy, 'pseudo') and pupy.pseudo):
        modules = marshal.loads(zlib.decompress(pupy._get_compressed_library_string()))
except ImportError:
    #modules = marshal.loads(zlib.decompress(open("resources\\library_compressed_string.txt",'rb').read()))
    pass

def get_module_files(fullname):
    """ return the file to load """
    global modules
    f=fullname.replace(".","/")
    files=[]
    for x in modules.iterkeys():
        if x.rsplit(".",1)[0]==f or f+"/__init__.py"==x or f+"/__init__.pyc"==x or f+"/__init__.pyo"==x:
            files.append(x)
    return files

def pupy_add_package(pkdic):
Ejemplo n.º 3
0
def dprint(msg):
    global __debug
    if __debug:
        print msg

try:
    import _memimporter
    builtin_memimporter = True
except ImportError:
    builtin_memimporter = False

modules={}
try:
    import pupy
    if not (hasattr(pupy, 'pseudo') and pupy.pseudo):
        modules = marshal.loads(zlib.decompress(pupy._get_compressed_library_string()))
except ImportError:
    pass

def get_module_files(fullname):
    """ return the file to load """
    global modules
    path = fullname.replace('.','/')

    return [
        module for module in modules.iterkeys() \
        if module.rsplit(".",1)[0] == path or any([
            path+'/__init__'+ext == module for ext in [
                '.py', '.pyc', '.pyo'
            ]
        ])