Skip to content

Commit

Permalink
avoid extra isfile() call in sha256_checksum
Browse files Browse the repository at this point in the history
  • Loading branch information
dholth committed Jul 22, 2024
1 parent 9480525 commit 74b09fa
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions conda_build/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 74b09fa

Please sign in to comment.