Skip to content

Commit 8091550

Browse files
committed
fix: use choco to install python on windows
1 parent f21f0db commit 8091550

File tree

4 files changed

+10
-18
lines changed

4 files changed

+10
-18
lines changed

dist/setup_cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/setup_cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
"@actions/io": "^1.1.1",
3636
"@actions/tool-cache": "^1.7.1",
3737
"execa": "^5.1.1",
38-
"hasha": "^5.2.2",
3938
"mri": "^1.2.0",
4039
"msvc-dev-cmd": "git://github.com/aminya/msvc-dev-cmd#9f672c1",
4140
"semver": "^7.3.5",

src/python/python.ts

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@ import { addPath } from "../utils/path/addPath"
33
import { setupAptPack } from "../utils/setup/setupAptPack"
44
import { setupBrewPack } from "../utils/setup/setupBrewPack"
55
import { setupChocoPack } from "../utils/setup/setupChocoPack"
6-
import hasha from "hasha"
7-
import { join } from "path"
86
import { isGitHubCI } from "../utils/env/isci"
97

108
export function setupPython(version: string, setupDir: string, arch: string) {
11-
if (!isGitHubCI()) {
12-
// TODO parse versoin
13-
return setupPythonViaSystem("", setupDir, arch)
9+
if (!isGitHubCI() || process.platform === "win32") {
10+
// TODO parse version
11+
return setupPythonViaSystem(version, setupDir, arch)
1412
}
1513
try {
1614
// eslint-disable-next-line @typescript-eslint/no-var-requires
@@ -21,20 +19,15 @@ export function setupPython(version: string, setupDir: string, arch: string) {
2119
}
2220
}
2321

24-
export async function setupPythonViaSystem(version: string, setupDir: string, arch: string) {
22+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
23+
export async function setupPythonViaSystem(version: string, setupDir: string, _arch: string) {
2524
switch (process.platform) {
2625
case "win32": {
27-
// Get an unique output directory name from the URL.
28-
const key: string = await hasha.async(version + arch, { algorithm: "md5" })
29-
const installDir = join(setupDir, key, "python")
30-
const binDir = installDir
31-
await setupChocoPack("python3", version, [`/InstallDir:${installDir}`])
32-
26+
await setupChocoPack("python3", version, [`/InstallDir:${setupDir}`])
3327
// Adding the bin dir to the path
3428
/** The directory which the tool is installed to */
35-
activateWinPython(binDir)
36-
37-
return { installDir, binDir }
29+
activateWinPython(setupDir)
30+
return { installDir: setupDir, binDir: setupDir }
3831
}
3932
case "darwin": {
4033
return setupBrewPack("python3", version)

0 commit comments

Comments
 (0)