fix: install pipx system-wide first

This commit is contained in:
Amin Yahyaabadi 2025-01-12 03:20:44 -08:00
parent 770dfb4c2c
commit 113d1f50d6
5 changed files with 11 additions and 9 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -55,11 +55,13 @@ async function setupPipx(foundPython: string) {
try {
if (!(await hasPipx(foundPython))) {
try {
await setupPipPackWithPython(foundPython, "pipx", undefined, { upgrade: true, usePipx: false })
} catch (err) {
if (setupPipPackSystem("pipx", false) === null) {
throw new Error(`pipx was not installed correctly ${err}`)
// first try with the system-wide pipx
if ((await setupPipPackSystem("pipx", isArch())) === null) {
// try with pip
await setupPipPackWithPython(foundPython, "pipx", undefined, { upgrade: true, usePipx: false })
}
} catch (err) {
throw new Error(`pipx was not installed correctly ${err}`)
}
}
await execa(foundPython, ["-m", "pipx", "ensurepath"], { stdio: "inherit" })
@ -84,7 +86,7 @@ async function setupVenv(foundPython: string) {
async function hasVenv(foundPython: string): Promise<boolean> {
try {
// check if venv module exits
await execa(foundPython, ["-m", "venv", "-h"], { stdio: "inherit" })
await execa(foundPython, ["-m", "venv", "-h"], { stdio: "ignore" })
return true
} catch {
// if module not found, continue