File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change 1+ Re-caculate artifact files and hashes when the lock target changes.
Original file line number Diff line number Diff line change @@ -62,15 +62,17 @@ def do_lock(
6262 if strategy_change and append :
6363 raise PdmUsageError ("Not allowed to change lock strategy when --append is used." )
6464 locked_repo = project .get_locked_repository ()
65+ candidates = [entry .candidate for entry in locked_repo .packages .values ()]
66+ if refresh or env_spec is not None :
67+ # Refetch hashes if --platform/--python/--implementation/--refresh is used
68+ for c in candidates :
69+ c .hashes .clear ()
6570 if refresh :
6671 if env_spec is not None :
6772 raise PdmUsageError ("Cannot pass --python/--platform/--implementation with --refresh" )
6873 repo = project .get_repository ()
6974 with project .core .ui .open_spinner ("Re-calculating hashes..." ):
7075 with project .core .ui .logging ("lock" ):
71- candidates = [entry .candidate for entry in locked_repo .packages .values ()]
72- for c in candidates :
73- c .hashes .clear ()
7476 repo .fetch_hashes (candidates )
7577 project .lockfile .format_lockfile (locked_repo , groups = project .lockfile .groups , strategy = lock_strategy )
7678 project .write_lockfile ()
You can’t perform that action at this time.
0 commit comments