Path: blob/main/Tools/c-analyzer/distutils/dep_util.py
12 views
"""distutils.dep_util12Utility functions for simple, timestamp-based dependency of files3and groups of files; also, function based entirely on such4timestamp dependency analysis."""56import os7from distutils.errors import DistutilsFileError8910def newer (source, target):11"""Return true if 'source' exists and is more recently modified than12'target', or if 'source' exists and 'target' doesn't. Return false if13both exist and 'target' is the same age or younger than 'source'.14Raise DistutilsFileError if 'source' does not exist.15"""16if not os.path.exists(source):17raise DistutilsFileError("file '%s' does not exist" %18os.path.abspath(source))19if not os.path.exists(target):20return 12122from stat import ST_MTIME23mtime1 = os.stat(source)[ST_MTIME]24mtime2 = os.stat(target)[ST_MTIME]2526return mtime1 > mtime22728# newer ()293031