mirror of https://github.com/aminya/setup-cpp
fix: use user flag when installing packages via pip
This commit is contained in:
parent
e0bca0a01d
commit
1f59ba33f1
|
@ -20,13 +20,15 @@ export async function setupPipPackWithPython(
|
||||||
name: string,
|
name: string,
|
||||||
version?: string,
|
version?: string,
|
||||||
upgrade = false,
|
upgrade = false,
|
||||||
|
user = true,
|
||||||
): Promise<InstallationInfo> {
|
): Promise<InstallationInfo> {
|
||||||
info(`Installing ${name} ${version ?? ""} via pip`)
|
info(`Installing ${name} ${version ?? ""} via pip`)
|
||||||
|
|
||||||
const nameAndVersion = version !== undefined && version !== "" ? `${name}==${version}` : name
|
const nameAndVersion = version !== undefined && version !== "" ? `${name}==${version}` : name
|
||||||
const upgradeFlag = upgrade === true ? ["--upgrade"] : []
|
const upgradeFlag = upgrade === true ? ["--upgrade"] : []
|
||||||
|
const userFlag = user === true ? ["--user"] : []
|
||||||
|
|
||||||
execaSync(givenPython, ["-m", "pip", "install", ...upgradeFlag, nameAndVersion], {
|
execaSync(givenPython, ["-m", "pip", "install", ...upgradeFlag, ...userFlag, nameAndVersion], {
|
||||||
stdio: "inherit",
|
stdio: "inherit",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue