mirror of https://github.com/aminya/setup-cpp
fix: install pipx using apt without a prefix on Linux
This commit is contained in:
parent
4e8c2f8bfb
commit
5eefa3d4ef
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
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -44,7 +44,13 @@ export async function setupPython(version: string, setupDir: string, arch: strin
|
||||||
async function setupPipx(foundPython: string) {
|
async function setupPipx(foundPython: string) {
|
||||||
try {
|
try {
|
||||||
if (!(await hasPipx(foundPython))) {
|
if (!(await hasPipx(foundPython))) {
|
||||||
await setupPipPackWithPython(foundPython, "pipx", undefined, { upgrade: true, usePipx: false })
|
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}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
await execa(foundPython, ["-m", "pipx", "ensurepath"], { stdio: "inherit" })
|
await execa(foundPython, ["-m", "pipx", "ensurepath"], { stdio: "inherit" })
|
||||||
await setupPipPackWithPython(foundPython, "venv", undefined, { upgrade: false, usePipx: false })
|
await setupPipPackWithPython(foundPython, "venv", undefined, { upgrade: false, usePipx: false })
|
||||||
|
|
|
@ -174,15 +174,15 @@ async function findBinDir(dirs: string[], name: string) {
|
||||||
return dirs[dirs.length - 1]
|
return dirs[dirs.length - 1]
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setupPipPackSystem(name: string) {
|
export function setupPipPackSystem(name: string, addPythonPrefix = true) {
|
||||||
if (process.platform === "linux") {
|
if (process.platform === "linux") {
|
||||||
info(`Installing ${name} via the system package manager`)
|
info(`Installing ${name} via the system package manager`)
|
||||||
if (isArch()) {
|
if (isArch()) {
|
||||||
return setupPacmanPack(`python-${name}`)
|
return setupPacmanPack(addPythonPrefix ? `python-${name}` : name)
|
||||||
} else if (hasDnf()) {
|
} else if (hasDnf()) {
|
||||||
return setupDnfPack([{ name: `python3-${name}` }])
|
return setupDnfPack([{ name: addPythonPrefix ? `python3-${name}` : name }])
|
||||||
} else if (isUbuntu()) {
|
} else if (isUbuntu()) {
|
||||||
return setupAptPack([{ name: `python3-${name}` }])
|
return setupAptPack([{ name: addPythonPrefix ? `python3-${name}` : name }])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
|
|
Loading…
Reference in New Issue