@@ -3,7 +3,7 @@ import { getExecOutput } from "@actions/exec"
3
3
import assert from "assert"
4
4
import { GITHUB_ACTIONS } from "ci-info"
5
5
import { info , warning } from "ci-log"
6
- import { execaSync } from "execa"
6
+ import { execa } from "execa"
7
7
import memoize from "micro-memoize"
8
8
import { addExeExt , dirname , join } from "patha"
9
9
import which from "which"
@@ -21,6 +21,7 @@ import { isBinUptoDate } from "../utils/setup/version"
21
21
import { unique } from "../utils/std"
22
22
import { MinVersions } from "../versions/default_versions"
23
23
import { pathExists } from "path-exists"
24
+ import { setupPipPackWithPython } from "../utils/setup/setupPipPack"
24
25
25
26
export async function setupPython ( version : string , setupDir : string , arch : string ) : Promise < InstallationInfo > {
26
27
const installInfo = await findOrSetupPython ( version , setupDir , arch )
@@ -33,11 +34,12 @@ export async function setupPython(version: string, setupDir: string, arch: strin
33
34
throw new Error ( "pip was not installed correctly" )
34
35
}
35
36
36
- // setup wheel
37
+ // setup wheel and setuptools
37
38
try {
38
- setupWheel ( foundPython )
39
+ await setupPipPackWithPython ( foundPython , "setuptools" , undefined , true )
40
+ await setupPipPackWithPython ( foundPython , "wheel" , undefined , true )
39
41
} catch ( err ) {
40
- warning ( `Failed to install wheels : ${ ( err as Error ) . toString ( ) } . Ignoring...` )
42
+ warning ( `Failed to install setuptools or wheel : ${ ( err as Error ) . toString ( ) } . Ignoring...` )
41
43
}
42
44
43
45
return installInfo
@@ -194,23 +196,23 @@ async function isPipUptoDate(pip: string) {
194
196
}
195
197
196
198
async function setupPip ( foundPython : string ) {
197
- const upgraded = ensurePipUpgrade ( foundPython )
199
+ const upgraded = await ensurePipUpgrade ( foundPython )
198
200
if ( ! upgraded ) {
199
201
await setupPipSystem ( )
200
202
// upgrade pip
201
- ensurePipUpgrade ( foundPython )
203
+ await ensurePipUpgrade ( foundPython )
202
204
}
203
205
}
204
206
205
- function ensurePipUpgrade ( foundPython : string ) {
207
+ async function ensurePipUpgrade ( foundPython : string ) {
206
208
try {
207
- execaSync ( foundPython , [ "-m" , "ensurepip" , "-U" , "--upgrade" ] , { stdio : "inherit" } )
209
+ await execa ( foundPython , [ "-m" , "ensurepip" , "-U" , "--upgrade" ] , { stdio : "inherit" } )
208
210
return true
209
211
} catch ( err1 ) {
210
212
info ( ( err1 as Error ) ?. toString ?.( ) )
211
213
try {
212
214
// ensure pip is disabled on Ubuntu
213
- execaSync ( foundPython , [ "-m" , "pip" , "install" , "--upgrade" , "pip" ] , { stdio : "inherit" } )
215
+ await execa ( foundPython , [ "-m" , "pip" , "install" , "--upgrade" , "pip" ] , { stdio : "inherit" } )
214
216
return true
215
217
} catch ( err2 ) {
216
218
info ( ( err2 as Error ) ?. toString ?.( ) )
@@ -235,11 +237,6 @@ function setupPipSystem() {
235
237
throw new Error ( `Could not install pip on ${ process . platform } ` )
236
238
}
237
239
238
- /** Install wheel (required for Conan, Meson, etc.) */
239
- function setupWheel ( foundPython : string ) {
240
- execaSync ( foundPython , [ "-m" , "pip" , "install" , "-U" , "wheel" ] , { stdio : "inherit" } )
241
- }
242
-
243
240
async function addPythonBaseExecPrefix_raw ( python : string ) {
244
241
const dirs : string [ ] = [ ]
245
242
0 commit comments