mirror of https://github.com/aminya/setup-cpp
fix: check if the pip executable is working on windows
This commit is contained in:
parent
9a6f97440c
commit
7523d162da
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -23,7 +23,7 @@ export function setupPython(version: string, setupDir: string, arch: string) {
|
||||||
export async function setupPythonViaSystem(version: string, setupDir: string, _arch: string) {
|
export async function setupPythonViaSystem(version: string, setupDir: string, _arch: string) {
|
||||||
switch (process.platform) {
|
switch (process.platform) {
|
||||||
case "win32": {
|
case "win32": {
|
||||||
await setupChocoPack("python3", version, [`/InstallDir:${setupDir}`])
|
setupChocoPack("python3", version, setupDir ? [`/InstallDir:${setupDir}`] : [])
|
||||||
// Adding the bin dir to the path
|
// Adding the bin dir to the path
|
||||||
/** The directory which the tool is installed to */
|
/** The directory which the tool is installed to */
|
||||||
activateWinPython(setupDir)
|
activateWinPython(setupDir)
|
||||||
|
|
|
@ -7,6 +7,7 @@ import { addPath } from "../path/addPath"
|
||||||
import { setupPython } from "../../python/python"
|
import { setupPython } from "../../python/python"
|
||||||
import { isBinUptoDate } from "./version"
|
import { isBinUptoDate } from "./version"
|
||||||
import { join } from "path"
|
import { join } from "path"
|
||||||
|
import { getVersion } from "../../default_versions"
|
||||||
|
|
||||||
let pip: string | undefined
|
let pip: string | undefined
|
||||||
|
|
||||||
|
@ -25,6 +26,15 @@ export async function setupPipPack(name: string, version?: string) {
|
||||||
pip = "pip3"
|
pip = "pip3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (process.platform === "win32") {
|
||||||
|
try {
|
||||||
|
// test if pip executable is working
|
||||||
|
await execa(pip, ["--version"], { stdio: "inherit" })
|
||||||
|
} catch (err) {
|
||||||
|
await setupPython(getVersion("python", undefined), "", process.arch)
|
||||||
|
pip = "pip3"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
execa.sync(pip, ["install", version !== undefined && version !== "" ? `${name}==${version}` : name], {
|
execa.sync(pip, ["install", version !== undefined && version !== "" ? `${name}==${version}` : name], {
|
||||||
stdio: "inherit",
|
stdio: "inherit",
|
||||||
|
|
Loading…
Reference in New Issue