mirror of https://github.com/aminya/setup-cpp
Merge pull request #230 from aminya/pipx [skip ci]
This commit is contained in:
commit
88ef2fc50d
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) {
|
||||
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}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
await execa(foundPython, ["-m", "pipx", "ensurepath"], { stdio: "inherit" })
|
||||
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]
|
||||
}
|
||||
|
||||
export function setupPipPackSystem(name: string) {
|
||||
export function setupPipPackSystem(name: string, addPythonPrefix = true) {
|
||||
if (process.platform === "linux") {
|
||||
info(`Installing ${name} via the system package manager`)
|
||||
if (isArch()) {
|
||||
return setupPacmanPack(`python-${name}`)
|
||||
return setupPacmanPack(addPythonPrefix ? `python-${name}` : name)
|
||||
} else if (hasDnf()) {
|
||||
return setupDnfPack([{ name: `python3-${name}` }])
|
||||
return setupDnfPack([{ name: addPythonPrefix ? `python3-${name}` : name }])
|
||||
} else if (isUbuntu()) {
|
||||
return setupAptPack([{ name: `python3-${name}` }])
|
||||
return setupAptPack([{ name: addPythonPrefix ? `python3-${name}` : name }])
|
||||
}
|
||||
}
|
||||
return null
|
||||
|
|
Loading…
Reference in New Issue