@@ -3,7 +3,7 @@ import { getExecOutput } from "@actions/exec"
33import assert from "assert"
44import { GITHUB_ACTIONS } from "ci-info"
55import { info , warning } from "ci-log"
6- import { execaSync } from "execa"
6+ import { execa } from "execa"
77import memoize from "micro-memoize"
88import { addExeExt , dirname , join } from "patha"
99import which from "which"
@@ -21,6 +21,7 @@ import { isBinUptoDate } from "../utils/setup/version"
2121import { unique } from "../utils/std"
2222import { MinVersions } from "../versions/default_versions"
2323import { pathExists } from "path-exists"
24+ import { setupPipPackWithPython } from "../utils/setup/setupPipPack"
2425
2526export async function setupPython ( version : string , setupDir : string , arch : string ) : Promise < InstallationInfo > {
2627 const installInfo = await findOrSetupPython ( version , setupDir , arch )
@@ -33,11 +34,12 @@ export async function setupPython(version: string, setupDir: string, arch: strin
3334 throw new Error ( "pip was not installed correctly" )
3435 }
3536
36- // setup wheel
37+ // setup wheel and setuptools
3738 try {
38- setupWheel ( foundPython )
39+ await setupPipPackWithPython ( foundPython , "setuptools" , undefined , true )
40+ await setupPipPackWithPython ( foundPython , "wheel" , undefined , true )
3941 } 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...` )
4143 }
4244
4345 return installInfo
@@ -194,23 +196,23 @@ async function isPipUptoDate(pip: string) {
194196}
195197
196198async function setupPip ( foundPython : string ) {
197- const upgraded = ensurePipUpgrade ( foundPython )
199+ const upgraded = await ensurePipUpgrade ( foundPython )
198200 if ( ! upgraded ) {
199201 await setupPipSystem ( )
200202 // upgrade pip
201- ensurePipUpgrade ( foundPython )
203+ await ensurePipUpgrade ( foundPython )
202204 }
203205}
204206
205- function ensurePipUpgrade ( foundPython : string ) {
207+ async function ensurePipUpgrade ( foundPython : string ) {
206208 try {
207- execaSync ( foundPython , [ "-m" , "ensurepip" , "-U" , "--upgrade" ] , { stdio : "inherit" } )
209+ await execa ( foundPython , [ "-m" , "ensurepip" , "-U" , "--upgrade" ] , { stdio : "inherit" } )
208210 return true
209211 } catch ( err1 ) {
210212 info ( ( err1 as Error ) ?. toString ?.( ) )
211213 try {
212214 // 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" } )
214216 return true
215217 } catch ( err2 ) {
216218 info ( ( err2 as Error ) ?. toString ?.( ) )
@@ -235,11 +237,6 @@ function setupPipSystem() {
235237 throw new Error ( `Could not install pip on ${ process . platform } ` )
236238}
237239
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-
243240async function addPythonBaseExecPrefix_raw ( python : string ) {
244241 const dirs : string [ ] = [ ]
245242
0 commit comments