Exemplo n.º 1
0
def resolve_depend(depend, include_dirs):
    if depend[0] == '<' and depend[-1] == '>':
        return None
    for dir in include_dirs:
        path = join_path(dir, depend)
        if path_exists(path):
            return os.path.normpath(path)
    return None
Exemplo n.º 2
0
def resolve_depend(depend, include_dirs):
    if depend[0] == '<' and depend[-1] == '>':
        return None
    for dir in include_dirs:
        path = join_path(dir, depend)
        if path_exists(path):
            return os.path.normpath(path)
    return None
Exemplo n.º 3
0
def normalize_existing0(base_dir, rel_paths):
    normalized = []
    for rel in rel_paths:
        path = join_path(base_dir, rel)
        if path_exists(path):
            normalized.append(os.path.normpath(path))
        else:
            normalized.append(rel)
    return normalized
Exemplo n.º 4
0
def normalize_existing0(base_dir, rel_paths):
    normalized = []
    for rel in rel_paths:
        path = join_path(base_dir, rel)
        if path_exists(path):
            normalized.append(os.path.normpath(path))
        else:
            normalized.append(rel)
    return normalized
Exemplo n.º 5
0
def resolve_depends(depends, include_dirs, base):
    include_dirs = tuple(include_dirs)
    resolved = []
    for depend in depends:
        if path_exists(join_path(base, depend)):
            resolved.append(join_path(base, depend))
            continue
        path = resolve_depend(depend, include_dirs)
        if path is not None:
            resolved.append(path)
    return resolved
Exemplo n.º 6
0
 def cimported_files(self, filename):
     if filename[-4:] == '.pyx' and path_exists(filename[:-4] + '.pxd'):
         pxd_list = [filename[:-4] + '.pxd']
     else:
         pxd_list = []
     for module in self.cimports(filename):
         if module[:7] == 'cython.' or module == 'cython':
             continue
         pxd_file = self.find_pxd(module, filename)
         if pxd_file is not None:
             pxd_list.append(pxd_file)
         elif not self.quiet:
             print("missing cimport in module '%s': %s" % (module, filename))
     return tuple(pxd_list)
Exemplo n.º 7
0
 def cimported_files(self, filename):
     if filename[-4:] == '.pyx' and path_exists(filename[:-4] + '.pxd'):
         pxd_list = [filename[:-4] + '.pxd']
     else:
         pxd_list = []
     for module in self.cimports(filename):
         if module[:7] == 'cython.' or module == 'cython':
             continue
         pxd_file = self.find_pxd(module, filename)
         if pxd_file is not None:
             pxd_list.append(pxd_file)
         elif not self.quiet:
             print("missing cimport in module '%s': %s" % (module, filename))
     return tuple(pxd_list)
Exemplo n.º 8
0
 def included_files(self, filename):
     # This is messy because included files are textually included, resolving
     # cimports (and other includes) relative to the including file.
     all = set()
     for include in self.parse_dependencies(filename)[1]:
         include_path = os.path.join(os.path.dirname(filename), include)
         if not path_exists(include_path):
             include_path = self.context.find_include_file(include, None)
         if include_path:
             if '.' + os.path.sep in include_path:
                 include_path = os.path.normpath(include_path)
             all.add(include_path)
         else:
             print("Unable to locate '%s' referenced from '%s'" % (filename, include))
     return all
Exemplo n.º 9
0
 def included_files(self, filename):
     # This is messy because included files are textually included, resolving
     # cimports (but not includes) relative to the including file.
     all = set()
     for include in self.parse_dependencies(filename)[1]:
         include_path = join_path(os.path.dirname(filename), include)
         if not path_exists(include_path):
             include_path = self.context.find_include_file(include, None)
         if include_path:
             if '.' + os.path.sep in include_path:
                 include_path = os.path.normpath(include_path)
             all.add(include_path)
             all.update(self.included_files(include_path))
         elif not self.quiet:
             print("Unable to locate '%s' referenced from '%s'" % (filename, include))
     return all
Exemplo n.º 10
0
def package(filename):
    dir = os.path.dirname(os.path.abspath(str(filename)))
    if dir != filename and path_exists(join_path(dir, '__init__.py')):
        return package(dir) + (os.path.basename(dir),)
    else:
        return ()
Exemplo n.º 11
0
def package(filename):
    dir = os.path.dirname(os.path.abspath(str(filename)))
    if dir != filename and path_exists(join_path(dir, '__init__.py')):
        return package(dir) + (os.path.basename(dir), )
    else:
        return ()