@@ -7,35 +7,28 @@ import { addPath } from "../path/addPath"
7
7
import { setupPython } from "../../python/python"
8
8
import { isBinUptoDate } from "./version"
9
9
import { join } from "path"
10
+ import { isGitHubCI } from "../env/isci"
10
11
import { getVersion } from "../../default_versions"
11
- import { untildify_user as untildify } from "../path/untildify"
12
12
13
13
let pip : string | undefined
14
- let python : string = "python3"
15
14
16
15
let binDir : string | undefined
17
16
18
17
/** A function that installs a package using pip */
19
18
export async function setupPipPack ( name : string , version ?: string ) {
20
19
// setup python and pip if needed
21
20
if ( pip === undefined ) {
22
- if ( process . platform === "win32" ) {
23
- const installationInfo = await setupPython ( getVersion ( "python" , undefined ) , untildify ( "python" ) , process . arch )
24
- if ( installationInfo ?. installDir !== undefined ) {
25
- pip = join ( installationInfo . installDir , "Scripts" , "pip3.exe" )
26
- python = join ( installationInfo . installDir , "python.exe" )
27
- } else {
28
- pip = "pip3"
29
- }
21
+ if ( isGitHubCI ( ) && process . platform === "win32" ) {
22
+ // run setupPython in actions_python anyways
23
+ await setupPython ( getVersion ( "python" , undefined ) , "" , process . arch )
24
+ }
25
+ if ( which . sync ( "pip3" , { nothrow : true } ) !== null ) {
26
+ pip = "pip3"
27
+ } else if ( which . sync ( " pip" , { nothrow : true } ) !== null && ( await isBinUptoDate ( "python" , "3.0.0" ) ) ) {
28
+ pip = "pip"
30
29
} else {
31
- if ( which . sync ( "pip3" , { nothrow : true } ) !== null ) {
32
- pip = "pip3"
33
- } else if ( which . sync ( "pip" , { nothrow : true } ) !== null && ( await isBinUptoDate ( "python" , "3.0.0" ) ) ) {
34
- pip = "pip"
35
- } else {
36
- await setupPython ( "3.x" , "" , process . arch )
37
- pip = "pip3"
38
- }
30
+ await setupPython ( "3.x" , "" , process . arch )
31
+ pip = "pip3"
39
32
}
40
33
}
41
34
@@ -52,7 +45,7 @@ export async function setupPipPack(name: string, version?: string) {
52
45
// windows or others
53
46
try {
54
47
binDir = join (
55
- ( await getExecOutput ( `${ python } -c "import sys;print(sys.base_exec_prefix);"` ) ) . stdout . trim ( ) ,
48
+ ( await getExecOutput ( `python3 -c "import sys;print(sys.base_exec_prefix);"` ) ) . stdout . trim ( ) ,
56
49
"Scripts"
57
50
)
58
51
} catch {
0 commit comments