Skip to content

Commit 620381d

Browse files
committed
relock when lock file is incompatible
1 parent 554bef0 commit 620381d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pdm/cli/commands/install.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,12 @@ def handle(self, project: Project, options: argparse.Namespace) -> None:
2828
actions.ask_for_import(project)
2929

3030
if options.lock:
31-
if not project.lockfile_file.exists():
31+
if not (
32+
project.lockfile_file.exists() and project.is_lockfile_compatible()
33+
):
3234
project.core.ui.echo(
33-
"Lock file does not exist, trying to generate one..."
35+
"Lock file does not exist or is incompatible, "
36+
"trying to generate one..."
3437
)
3538
actions.do_lock(project, strategy="all")
3639
elif not project.is_lockfile_hash_match():

0 commit comments

Comments
 (0)