def find_project_root(self, path):
        f = File(path)
        project_files = (".git", ".ropeproject", ".bzr", ".hg", ".scribes_project")
        while True:
            if any(f.get_child(r).query_exists() for r in project_files):
                return f.get_uri()

            p = f.get_parent()
            if p:
                f = p
            else:
                return path
    def find_project_root(self, path):
        f = File(path)
        project_files = ('.git', '.ropeproject', '.bzr', '.hg',
                         '.scribes_project')
        while True:
            if any(f.get_child(r).query_exists() for r in project_files):
                return f.get_uri()

            p = f.get_parent()
            if p:
                f = p
            else:
                return path
Exemplo n.º 3
0
def find_project_root(uri):
    f = File(uri)
    special_names = ('.ropeproject', '.git', '.hg', '.bzr', '.scribes_project')
    while True:
        for name in special_names:
            if f.get_child(name).query_exists():
                return f.get_path()

        p = f.get_parent()
        if p:
            f = p
        else:
            return None
Exemplo n.º 4
0
def find_project_root(uri):
    f = File(uri)
    special_names = ('.ropeproject', '.git', '.hg', '.bzr', '.scribes_project')
    while True:
        for name in special_names:
            if f.get_child(name).query_exists():
                return f.get_path()

        p = f.get_parent()
        if p:
            f = p
        else:
            return None
def get_python_title(uri):
    f = File(uri)
    title = f.get_basename()
    packages = []
    while True:
        f = f.get_parent()
        if not f: break
        
        if f.get_child('__init__.py').query_exists():
            packages.append(f.get_basename())
        else:
            break
            
    if packages:
        if title != '__init__.py':
            packages.insert(0, title.partition('.py')[0])
            
        return '.'.join(reversed(packages))
    else:
        return title