fix(dev): resolve stale editable packages together
This commit is contained in:
@@ -236,7 +236,7 @@ def build_install_plan(
|
||||
removed_paths = set(previous_inputs) - set(current_inputs)
|
||||
stale_requirements = requirements_key in changed_paths or requirements_key in removed_paths
|
||||
|
||||
commands: list[tuple[str, ...]] = []
|
||||
installs: list[tuple[str, ...]] = []
|
||||
warnings: list[str] = []
|
||||
|
||||
if stale_requirements:
|
||||
@@ -247,8 +247,7 @@ def build_install_plan(
|
||||
"requirements changed in a way that needs the full resolver.",
|
||||
(full_command,),
|
||||
)
|
||||
for install_args in delta.commands:
|
||||
commands.append((python, "-m", "pip", "install", *install_args))
|
||||
installs.extend(delta.commands)
|
||||
warnings.extend(delta.warnings)
|
||||
changed_paths.discard(requirements_key)
|
||||
removed_paths.discard(requirements_key)
|
||||
@@ -266,7 +265,7 @@ def build_install_plan(
|
||||
f"tracked input changed outside a known local project: {path}",
|
||||
(full_command,),
|
||||
)
|
||||
commands.append((python, "-m", "pip", "install", *entry.install_args))
|
||||
installs.append(entry.install_args)
|
||||
|
||||
if removed_paths:
|
||||
return InstallPlan(
|
||||
@@ -275,12 +274,19 @@ def build_install_plan(
|
||||
(full_command,),
|
||||
)
|
||||
|
||||
deduped_commands = tuple(dict.fromkeys(commands))
|
||||
if deduped_commands:
|
||||
deduped_installs = tuple(dict.fromkeys(installs))
|
||||
if deduped_installs:
|
||||
command = (
|
||||
python,
|
||||
"-m",
|
||||
"pip",
|
||||
"install",
|
||||
*(argument for install_args in deduped_installs for argument in install_args),
|
||||
)
|
||||
return InstallPlan(
|
||||
"Selective Python environment sync",
|
||||
f"installing {len(deduped_commands)} stale local requirement(s).",
|
||||
deduped_commands,
|
||||
f"installing {len(deduped_installs)} stale local requirement(s) in one resolver transaction.",
|
||||
(command,),
|
||||
tuple(warnings),
|
||||
)
|
||||
return InstallPlan(
|
||||
|
||||
Reference in New Issue
Block a user