Bug 1896688 - Prevent unnecessary os.stat call in jar.py r=sergesanspaille

If the destination file doesn't exist, we don't need to check the
current file's time, and we can just write or symlink regardless.

Differential Revision: https://phabricator.services.mozilla.com/D210330
This commit is contained in:
ahochheiden 2024-05-17 21:35:05 +00:00
parent 57ae4a3404
commit 2366f9e588

View file

@ -517,7 +517,9 @@ class JarMaker(object):
# copy or symlink if newer
if getModTime(realsrc) > outHelper.getDestModTime(e.output):
# if the output doesn't exist, we can skip an os.stat call
out_mod_time = outHelper.getDestModTime(e.output)
if out_mod_time == localtime(0) or getModTime(realsrc) > out_mod_time:
if self.outputFormat == "symlink":
outHelper.symlink(realsrc, out)
return