def recursive_mtime(path):
    """Recursively get newest mtime of files"""
    if os.path.isfile(path):
        return mtime(path)
    current = 0
    for dirname, _, filenames in os.walk(path):
        if filenames:
            current = max(
                current, max(mtime(os.path.join(dirname, f)) for f in filenames)
            )
    return current
Recursively get newest mtime of files
setup.py