mirror of https://github.com/aminya/setup-cpp
fix: use choco to install python on windows
This commit is contained in:
parent
f21f0db888
commit
80915508cf
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -35,7 +35,6 @@
|
|||
"@actions/io": "^1.1.1",
|
||||
"@actions/tool-cache": "^1.7.1",
|
||||
"execa": "^5.1.1",
|
||||
"hasha": "^5.2.2",
|
||||
"mri": "^1.2.0",
|
||||
"msvc-dev-cmd": "git://github.com/aminya/msvc-dev-cmd#9f672c1",
|
||||
"semver": "^7.3.5",
|
||||
|
|
|
@ -3,14 +3,12 @@ import { addPath } from "../utils/path/addPath"
|
|||
import { setupAptPack } from "../utils/setup/setupAptPack"
|
||||
import { setupBrewPack } from "../utils/setup/setupBrewPack"
|
||||
import { setupChocoPack } from "../utils/setup/setupChocoPack"
|
||||
import hasha from "hasha"
|
||||
import { join } from "path"
|
||||
import { isGitHubCI } from "../utils/env/isci"
|
||||
|
||||
export function setupPython(version: string, setupDir: string, arch: string) {
|
||||
if (!isGitHubCI()) {
|
||||
// TODO parse versoin
|
||||
return setupPythonViaSystem("", setupDir, arch)
|
||||
if (!isGitHubCI() || process.platform === "win32") {
|
||||
// TODO parse version
|
||||
return setupPythonViaSystem(version, setupDir, arch)
|
||||
}
|
||||
try {
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
|
@ -21,20 +19,15 @@ export function setupPython(version: string, setupDir: string, arch: string) {
|
|||
}
|
||||
}
|
||||
|
||||
export async function setupPythonViaSystem(version: string, setupDir: string, arch: string) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
export async function setupPythonViaSystem(version: string, setupDir: string, _arch: string) {
|
||||
switch (process.platform) {
|
||||
case "win32": {
|
||||
// Get an unique output directory name from the URL.
|
||||
const key: string = await hasha.async(version + arch, { algorithm: "md5" })
|
||||
const installDir = join(setupDir, key, "python")
|
||||
const binDir = installDir
|
||||
await setupChocoPack("python3", version, [`/InstallDir:${installDir}`])
|
||||
|
||||
await setupChocoPack("python3", version, [`/InstallDir:${setupDir}`])
|
||||
// Adding the bin dir to the path
|
||||
/** The directory which the tool is installed to */
|
||||
activateWinPython(binDir)
|
||||
|
||||
return { installDir, binDir }
|
||||
activateWinPython(setupDir)
|
||||
return { installDir: setupDir, binDir: setupDir }
|
||||
}
|
||||
case "darwin": {
|
||||
return setupBrewPack("python3", version)
|
||||
|
|
Loading…
Reference in New Issue