From fed1d1b31397feff8bf1d9b021f22fc3724b13b0 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 3 Feb 2023 16:58:13 +0530 Subject: [PATCH] Make newer() robust against missing source files --- setup/__init__.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/setup/__init__.py b/setup/__init__.py index a1476b4f3b..4d353a4ac9 100644 --- a/setup/__init__.py +++ b/setup/__init__.py @@ -47,8 +47,12 @@ def newer(targets, sources): if not os.path.exists(f): return True ttimes = map(lambda x: os.stat(x).st_mtime, targets) - stimes = map(lambda x: os.stat(x).st_mtime, sources) - newest_source, oldest_target = max(stimes), min(ttimes) + oldest_target = max(ttimes) + try: + stimes = map(lambda x: os.stat(x).st_mtime, sources) + newest_source = max(stimes) + except FileNotFoundError: + newest_source = oldest_target +1 return newest_source > oldest_target