mirror of https://github.com/aminya/setup-cpp
fix: add the python base_exec_prefix path for all OS
This commit is contained in:
parent
d2f3163daf
commit
2dde08dd51
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
|
@ -48,7 +48,7 @@ export async function setupPythonViaSystem(
|
|||
join(setupDir, "python.exe")
|
||||
const pythonSetupDir = dirname(pythonBinPath)
|
||||
/** The directory which the tool is installed to */
|
||||
await activateWinPython(pythonSetupDir)
|
||||
await addPath(pythonSetupDir)
|
||||
return { installDir: pythonSetupDir, binDir: pythonSetupDir }
|
||||
}
|
||||
case "darwin": {
|
||||
|
@ -75,8 +75,3 @@ export async function setupPythonViaSystem(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function activateWinPython(binDir: string) {
|
||||
info(`Add ${binDir} to PATH`)
|
||||
await addPath(binDir)
|
||||
}
|
||||
|
|
|
@ -65,27 +65,17 @@ export async function setupPipPack(name: string, version?: string): Promise<Inst
|
|||
})
|
||||
|
||||
if (binDir === undefined) {
|
||||
if (process.platform === "linux") {
|
||||
binDir = "/home/runner/.local/bin/"
|
||||
} else if (process.platform === "darwin") {
|
||||
binDir = "/usr/local/bin/"
|
||||
} else {
|
||||
// windows or others
|
||||
try {
|
||||
binDir = join(
|
||||
(await getExecOutput(`${python} -c "import sys;print(sys.base_exec_prefix);"`)).stdout.trim(),
|
||||
"Scripts"
|
||||
)
|
||||
} catch {
|
||||
binDir = join(
|
||||
(await getExecOutput(`${python} -c "import sys;print(sys.base_exec_prefix);"`)).stdout.trim(),
|
||||
"Scripts"
|
||||
)
|
||||
}
|
||||
}
|
||||
info(`${binDir} to PATH`)
|
||||
await addPath(binDir)
|
||||
binDir = await addPythonBaseExecPrefix()
|
||||
}
|
||||
|
||||
return { binDir }
|
||||
}
|
||||
|
||||
async function addPythonBaseExecPrefix() {
|
||||
const base_exec_prefix = join(
|
||||
(await getExecOutput(`${python} -c "import sys;print(sys.base_exec_prefix);"`)).stdout.trim(),
|
||||
"Scripts"
|
||||
)
|
||||
await addPath(base_exec_prefix)
|
||||
return base_exec_prefix
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue