Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Feb 26, 2024
1 parent 8e328f4 commit f84a66a
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions conda_build/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ def download_to_cache(cache_folder, recipe_path, source_dict, verbose=False):
hash_added = False

for hash_type in set(source_dict).intersection(ACCEPTED_HASH_TYPES):
if source_dict[hash_type] in (None, ""):
raise ValueError(f"Empty {hash_type} hash provided for {fn}")
fn = append_hash_to_fn(fn, source_dict[hash_type])
hash_added = True
if source_dict[hash_type] in (None, ""):
raise ValueError(f"Empty {hash_type} hash provided for {fn}")
fn = append_hash_to_fn(fn, source_dict[hash_type])
hash_added = True
else:
log.warn(
f"No hash {ACCEPTED_HASH_TYPES} provided for {unhashed_fn}. Source download forced. "
Expand Down Expand Up @@ -121,13 +121,13 @@ def download_to_cache(cache_folder, recipe_path, source_dict, verbose=False):
hashed = None

for tp in set(source_dict).intersection(ACCEPTED_HASH_TYPES):
expected_hash = source_dict[tp]
hashed = hashsum_file(path, tp)
if expected_hash != hashed:
rm_rf(path)
raise RuntimeError(
f"{tp.upper()} mismatch: '{hashed}' != '{expected_hash}'"
)
expected_hash = source_dict[tp]
hashed = hashsum_file(path, tp)
if expected_hash != hashed:
rm_rf(path)
raise RuntimeError(
f"{tp.upper()} mismatch: '{hashed}' != '{expected_hash}'"
)

# this is really a fallback. If people don't provide the hash, we still need to prevent
# collisions in our source cache, but the end user will get no benefit from the cache.
Expand Down

0 comments on commit f84a66a

Please sign in to comment.