Skip to content

Commit

Permalink
fix(cli/use): don't install new version if already matching
Browse files Browse the repository at this point in the history
Signed-off-by: Frost Ming <[email protected]>
  • Loading branch information
frostming committed Mar 6, 2024
1 parent 435684d commit ac10fd7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/onepm/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,16 @@ def update_package_manager(self) -> None:

def use_package_manager(self, spec: str) -> None:
req = Requirement(spec)
self.install_tool(canonicalize_name(req.name), req)
name = canonicalize_name(req.name)
self.pyproject.setdefault("tool", {}).setdefault("onepm", {})[
"package-manager"
] = str(req)
with open(self.path / "pyproject.toml", "w") as f:
tomlkit.dump(self.pyproject, f)
for installation in self.get_installations(name):
if installation.version in req.specifier:
return
self.install_tool(canonicalize_name(req.name), req)


@dataclass(frozen=True)
Expand Down

0 comments on commit ac10fd7

Please sign in to comment.