Skip to content

Commit

Permalink
fix: pass python path to uv venv command (#3204)
Browse files Browse the repository at this point in the history
  • Loading branch information
frostming authored Oct 11, 2024
1 parent afcd1a5 commit dc8e3f4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions news/3204.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Pass the python path to the uv venv command.
10 changes: 9 additions & 1 deletion src/pdm/cli/commands/venv/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,15 @@ def pip_args(self, with_pip: bool) -> Iterable[str]:

def perform_create(self, location: Path, args: tuple[str, ...], prompt: str | None = None) -> None:
prompt_option = (f"--prompt={prompt}",) if prompt else ()
cmd = [*self.project.core.uv_cmd, "venv", *prompt_option, *args, str(location)]
cmd = [
*self.project.core.uv_cmd,
"venv",
"-p",
str(self._resolved_interpreter.executable),
*prompt_option,
*args,
str(location),
]
self.subprocess_call(cmd)


Expand Down
2 changes: 1 addition & 1 deletion src/pdm/formats/uv.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def build_pyproject_toml(self) -> Path:

def _enter_path(self, path: Path) -> Path:
if path.exists():
name = tempfile.mktemp(dir=path.parent, prefix=path.name)
name = tempfile.mktemp(dir=path.parent, prefix=f"{path.name}.")
backup = path.rename(name)

@self.stack.callback
Expand Down

0 comments on commit dc8e3f4

Please sign in to comment.