Exemplo n.º 1
0
def get_last_mtime(path, ignore_versioned=True):
    if ignore_versioned:
        if is_versioned(path):
            return
    mtimes = []
    for root, dirs, files in os.walk(path):
        if ignore_versioned:
            rmdirs = []
            for d in dirs:
                p = os.path.join(root, d)
                if is_versioned(p):
                    if settings.verbose:
                        print 'ignored', p
                    rmdirs.append(d)
            for d in rmdirs:
                dirs.remove(d)
        for f in files:
            p = os.path.join(root, f)
            if os.path.exists(p):
                mtimes.append(os.path.getmtime(p))
    mtimes.sort()
    if mtimes:
        return mtimes[-1]
    else:
        return 0