Skip to content

Commit

Permalink
fix: install venv before pip
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Jan 12, 2025
1 parent 025098a commit 770dfb4
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion dist/legacy/setup-cpp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/legacy/setup-cpp.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/modern/setup-cpp.mjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/modern/setup-cpp.mjs.map

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions src/python/python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,16 @@ export async function setupPython(
assert(installInfo.bin !== undefined)
const foundPython = installInfo.bin

// setup venv
await setupVenv(foundPython)

// setup pip
const foundPip = await findOrSetupPip(foundPython)
if (foundPip === undefined) {
throw new Error("pip was not installed correctly")
}

await setupPipx(foundPython)

await setupWheel(foundPython)

return installInfo as InstallationInfo & { bin: string }
Expand All @@ -61,19 +63,17 @@ async function setupPipx(foundPython: string) {
}
}
await execa(foundPython, ["-m", "pipx", "ensurepath"], { stdio: "inherit" })
await setupVenv(foundPython)
} catch (err) {
notice(`Failed to install pipx: ${(err as Error).toString()}. Ignoring...`)
}
}

async function setupVenv(foundPython: string) {
if (await hasVenv(foundPython)) {
info("venv module already installed.")
return
}

info("venv module not found. Installing it...")

try {
await setupPipPackSystem("venv")
} catch (err) {
Expand Down

0 comments on commit 770dfb4

Please sign in to comment.