Exemplo n.º 1
0
 def _find_file(self, interp, fname):
     if not exists(fname):
         for path in interp.include_path:
             if exists(join(path, [fname])):
                 return join(path, [fname])
     # this is stupid, but...
     actual_code_dir = dirname(interp.global_frame.bytecode.filename)
     if exists(join(actual_code_dir, [fname])):
         return join(actual_code_dir, [fname])
     return abspath(fname)
Exemplo n.º 2
0
def stream_resolve_include_path(interp, filename):
    """ Resolve filename against the include path"""

    for path in interp.include_path:
        fullpath = rpath.join(path, [filename])
        if rpath.exists(fullpath):
            return interp.space.wrap(rpath.realpath(fullpath))

    return interp.space.w_False
Exemplo n.º 3
0
def _spl_autoload(interp, class_name, file_extensions_list):
    class_id = class_name.lower()

    for extension in file_extensions_list:
        for path in interp.include_path:
            fname = rpath.join(path, ["%s%s" % (class_id, extension)])
            if rpath.exists(fname):
                bc = interp.compile_file(fname)
                interp.run_include(bc, interp.global_frame)
Exemplo n.º 4
0
def stream_resolve_include_path(interp, filename):
    """ Resolve filename against the include path"""

    for path in interp.include_path:
        fullpath = rpath.join(path, [filename])
        if rpath.exists(fullpath):
            return interp.space.wrap(rpath.realpath(fullpath))

    return interp.space.w_False