mirror of https://github.com/aminya/setup-cpp
fix: fisrt check python binary instead of python3
To avoid preferring brew over system python
This commit is contained in:
parent
381411326c
commit
d316735ce5
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
|
@ -183,7 +183,7 @@ async function setupPythonSystem(setupDir: string, version: string) {
|
|||
}
|
||||
|
||||
async function findPython(binDir?: string) {
|
||||
for (const pythonBin of ["python3", "python"]) {
|
||||
for (const pythonBin of ["python", "python3"]) {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
const foundPython = await isPythonUpToDate(pythonBin, binDir)
|
||||
if (foundPython !== undefined) {
|
||||
|
@ -215,10 +215,8 @@ async function isPythonUpToDate(candidate: string, binDir?: string) {
|
|||
try {
|
||||
if (binDir !== undefined) {
|
||||
const pythonBinPath = join(binDir, addExeExt(candidate))
|
||||
if (await pathExists(pythonBinPath)) {
|
||||
if (await isBinUptoDate(pythonBinPath, MinVersions.python!)) {
|
||||
return pythonBinPath
|
||||
}
|
||||
if (await pathExists(pythonBinPath) && await isBinUptoDate(pythonBinPath, MinVersions.python!)) {
|
||||
return pythonBinPath
|
||||
}
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
|
|
|
@ -50,6 +50,7 @@ export async function setupPipPackWithPython(
|
|||
const { usePipx = true, user = true, upgrade = false, isLibrary = false } = options
|
||||
|
||||
const isPipx = usePipx && !isLibrary && (await hasPipx(givenPython))
|
||||
|
||||
const pip = isPipx ? "pipx" : "pip"
|
||||
|
||||
// if upgrade is not requested, check if the package is already installed, and return if it is
|
||||
|
@ -104,7 +105,8 @@ async function finishPipPackageInstall(givenPython: string, name: string) {
|
|||
}
|
||||
|
||||
export async function hasPipx(givenPython: string) {
|
||||
return (await execa(givenPython, ["-m", "pipx", "--help"], { stdio: "ignore", reject: false })).exitCode === 0
|
||||
const res = await execa(givenPython, ["-m", "pipx", "--help"], { stdio: "ignore", reject: false })
|
||||
return res.exitCode === 0
|
||||
}
|
||||
|
||||
async function getPipxHome_() {
|
||||
|
|
Loading…
Reference in New Issue