/
githubmirror
/
cpython
Обзор
Документация
Войти
/
githubmirror
/
cpython
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
Tools/c-analyzer/distutils/dep_util.py
28 строк
878 B
Victor Stinner
gh-155358: Use named attributes with os module (#155366)
10 авг 2026, 21:31
Не верифицирован
10 авг 2026, 21:31
2e519dd
Код
Авторство
О чём код?
"""distutils.dep_util Utility functions for simple, timestamp-based dependency of files and groups of files; also, function based entirely on such timestamp dependency analysis.""" import os from distutils.errors import DistutilsFileError def newer (source, target): """Return true if 'source' exists and is more recently modified than 'target', or if 'source' exists and 'target' doesn't. Return false if both exist and 'target' is the same age or younger than 'source'. Raise DistutilsFileError if 'source' does not exist. """ if not os.path.exists(source): raise DistutilsFileError("file '%s' does not exist" % os.path.abspath(source)) if not os.path.exists(target): return 1 mtime1 = os.stat(source).st_mtime mtime2 = os.stat(target).st_mtime return mtime1 > mtime2 # newer ()