def needs_change(destination, dependencies): last_dependency_change = 0 for dependency in dependencies: if dependency is None: return False last_dependency_change = max( last_dependency_change, dependency.lstat().st_mtime ) if not destination.exists(): return True return destination.lstat().st_mtime < last_dependency_change