mirror of https://github.com/aminya/setup-cpp
fix: fix PIPX_HOME on Windows and MacOS
This commit is contained in:
parent
1a3ed1a856
commit
f3a5dc3f05
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
|
@ -61,8 +61,8 @@ export async function setupPipPackWithPython(
|
|||
|
||||
if (isPipx && user) {
|
||||
// install to user home
|
||||
env.PIPX_HOME = untildifyUser("~/.local/pipx")
|
||||
env.PIPX_BIN_DIR = untildifyUser("~/.local/bin")
|
||||
env.PIPX_HOME = await getPipxHome()
|
||||
env.PIPX_BIN_DIR = getPipxBinDir()
|
||||
}
|
||||
|
||||
execaSync(givenPython, ["-m", pip, ...upgradeFlag, ...userFlag, nameAndVersion], {
|
||||
|
@ -93,6 +93,28 @@ export async function hasPipx(givenPython: string) {
|
|||
return (await execa(givenPython, ["-m", "pipx", "--help"], { stdio: "ignore", reject: false })).exitCode === 0
|
||||
}
|
||||
|
||||
async function getPipxHome_raw() {
|
||||
// Based on https://pipx.pypa.io/stable/installation/
|
||||
const compatHome = untildifyUser("~/.local/pipx")
|
||||
if (await pathExists(compatHome)) {
|
||||
return compatHome
|
||||
}
|
||||
|
||||
switch (process.platform) {
|
||||
case "win32":
|
||||
return untildifyUser("~/AppData/Local/pipx")
|
||||
case "darwin":
|
||||
return untildifyUser("~/Library/Application Support/pipx")
|
||||
default:
|
||||
return untildifyUser("~/.local/share/pipx")
|
||||
}
|
||||
}
|
||||
const getPipxHome = memoize(getPipxHome_raw, { isPromise: true })
|
||||
|
||||
function getPipxBinDir() {
|
||||
return untildifyUser("~/.local/bin")
|
||||
}
|
||||
|
||||
async function getPython_raw(): Promise<string> {
|
||||
const pythonBin = (await setupPython(getVersion("python", undefined, await ubuntuVersion()), "", process.arch)).bin
|
||||
if (pythonBin === undefined) {
|
||||
|
|
Loading…
Reference in New Issue