From 74b09fa5d68eada1bdf195f70b930a55e5ab69a2 Mon Sep 17 00:00:00 2001 From: Daniel Holth Date: Mon, 22 Jul 2024 16:06:29 -0400 Subject: [PATCH] avoid extra isfile() call in sha256_checksum --- conda_build/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/conda_build/utils.py b/conda_build/utils.py index cc0ae3dc3d..392b2dd64b 100644 --- a/conda_build/utils.py +++ b/conda_build/utils.py @@ -1972,11 +1972,13 @@ def expand_reqs(reqs_entry): def sha256_checksum(filename, buffersize=65536): - if islink(filename) and not isfile(filename): + is_link = islink(filename) + is_file = isfile(filename) + if is_link and not is_file: # symlink to nowhere so an empty file # this is the sha256 hash of an empty file return "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - if not isfile(filename): + if not is_file: return None sha256 = hashlib.sha256() with open(filename, "rb") as f: