@@ -8,26 +8,48 @@ import { isGitHubCI } from "../utils/env/isci"
88import { cacheDependencies } from "./actions_cache"
99
1010function isPyPyVersion ( versionSpec : string ) {
11- return versionSpec . startsWith ( "pypy- " )
11+ return versionSpec . startsWith ( "pypy" )
1212}
1313
14+ // function resolveVersionInput(version: string): string {
15+ // let versionFile = getInput("python-version-file")
16+
17+ // if (version && versionFile) {
18+ // warning("Both python-version and python-version-file inputs are specified, only python-version will be used")
19+ // }
20+
21+ // if (version) {
22+ // return version
23+ // }
24+
25+ // versionFile = versionFile || ".python-version"
26+ // if (!existsSync(versionFile)) {
27+ // throw new Error(`The specified python version file at: ${versionFile} does not exist`)
28+ // }
29+ // version = readFileSync(versionFile, "utf8")
30+ // info(`Resolved ${versionFile} as ${version}`)
31+
32+ // return version
33+ // }
34+
1435export async function setupActionsPython ( version : string , _setupDir : string , arch : string ) {
1536 if ( process . env . AGENT_TOOLSDIRECTORY ?. trim ( ) ) {
16- debug ( `Python is expected to be installed into AGENT_TOOLSDIRECTORY=${ process . env . AGENT_TOOLSDIRECTORY } ` )
17- process . env . RUNNER_TOOL_CACHE = process . env . AGENT_TOOLSDIRECTORY
37+ debug ( `Python is expected to be installed into AGENT_TOOLSDIRECTORY=${ process . env [ " AGENT_TOOLSDIRECTORY" ] } ` )
38+ process . env [ " RUNNER_TOOL_CACHE" ] = process . env [ " AGENT_TOOLSDIRECTORY" ]
1839 } else {
19- debug ( `Python is expected to be installed into RUNNER_TOOL_CACHE==${ process . env . RUNNER_TOOL_CACHE } ` )
40+ debug ( `Python is expected to be installed into RUNNER_TOOL_CACHE==${ process . env [ " RUNNER_TOOL_CACHE" ] } ` )
2041 }
42+ // const version = resolveVersionInput(versionGiven)
2143 if ( version ) {
2244 let pythonVersion : string
2345 if ( isPyPyVersion ( version ) ) {
2446 const installed = await findPyPyVersion ( version , arch )
2547 pythonVersion = `${ installed . resolvedPyPyVersion } -${ installed . resolvedPythonVersion } `
26- info ( `Successfully setup PyPy ${ installed . resolvedPyPyVersion } with Python (${ installed . resolvedPythonVersion } )` )
48+ info ( `Successfully set up PyPy ${ installed . resolvedPyPyVersion } with Python (${ installed . resolvedPythonVersion } )` )
2749 } else {
2850 const installed = await useCpythonVersion ( version , arch )
2951 pythonVersion = installed . version
30- info ( `Successfully setup ${ installed . impl } (${ pythonVersion } )` )
52+ info ( `Successfully set up ${ installed . impl } (${ pythonVersion } )` )
3153 }
3254
3355 const cache = "pip" // core.getInput("cache") // package manager used for caching
0 commit comments