MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / newer

Function newer

tools/python-3.11.9-amd64/Lib/distutils/dep_util.py:11–27  ·  view source on GitHub ↗

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.

(source, target)

Source from the content-addressed store, hash-verified

9
10
11def newer (source, target):
12 """Return true if 'source' exists and is more recently modified than
13 'target', or if 'source' exists and 'target' doesn't. Return false if
14 both exist and 'target' is the same age or younger than 'source'.
15 Raise DistutilsFileError if 'source' does not exist.
16 """
17 if not os.path.exists(source):
18 raise DistutilsFileError("file '%s' does not exist" %
19 os.path.abspath(source))
20 if not os.path.exists(target):
21 return 1
22
23 from stat import ST_MTIME
24 mtime1 = os.stat(source)[ST_MTIME]
25 mtime2 = os.stat(target)[ST_MTIME]
26
27 return mtime1 > mtime2
28
29# newer ()
30

Callers 7

preprocessMethod · 0.90
copy_fileFunction · 0.90
preprocessMethod · 0.90
byte_compileFunction · 0.90
copy_scriptsMethod · 0.90
test_newerMethod · 0.90
newer_pairwiseFunction · 0.70

Calls 3

DistutilsFileErrorClass · 0.90
existsMethod · 0.45
statMethod · 0.45

Tested by 1

test_newerMethod · 0.72