Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avoid extra isfile() call in sha256_checksum #5422

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading