mirror of https://github.com/aminya/setup-cpp
fix: choose the python binary directory based on the existence
This commit is contained in:
parent
0f4b1a6238
commit
e376f26cd2
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
|
@ -149,12 +149,5 @@ export async function addPythonBaseExecPrefix(python: string) {
|
|||
// add the directories to the path
|
||||
await Promise.all(dirs.map((dir) => addPath(dir)))
|
||||
|
||||
// the last directory is the bin directory (not empty)
|
||||
const foundBinDir = dirs.pop()
|
||||
|
||||
if (foundBinDir === undefined) {
|
||||
warning("The binary directory for pip dependencies could not be found")
|
||||
}
|
||||
|
||||
return foundBinDir!
|
||||
return dirs
|
||||
}
|
||||
|
|
|
@ -3,9 +3,11 @@ import execa from "execa"
|
|||
import { info } from "@actions/core"
|
||||
import { addPythonBaseExecPrefix, setupPythonAndPip } from "../../python/python"
|
||||
import { InstallationInfo } from "./setupBin"
|
||||
import { existsSync } from "fs"
|
||||
import { addExeExt, join } from "patha"
|
||||
|
||||
let python: string | undefined
|
||||
let binDir: string | undefined
|
||||
let binDirs: string[] | undefined
|
||||
|
||||
/** A function that installs a package using pip */
|
||||
export async function setupPipPack(name: string, version?: string): Promise<InstallationInfo> {
|
||||
|
@ -19,9 +21,11 @@ export async function setupPipPack(name: string, version?: string): Promise<Inst
|
|||
stdio: "inherit",
|
||||
})
|
||||
|
||||
if (binDir === undefined) {
|
||||
binDir = await addPythonBaseExecPrefix(python)
|
||||
if (binDirs === undefined) {
|
||||
binDirs = await addPythonBaseExecPrefix(python)
|
||||
}
|
||||
|
||||
const binDir = binDirs.find((dir) => existsSync(join(dir, addExeExt(name)))) ?? binDirs.pop()!
|
||||
|
||||
return { binDir }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue