2021-09-20 20:24:17 +08:00
|
|
|
import * as core from "@actions/core"
|
2021-12-05 22:16:28 +08:00
|
|
|
import * as finder from "setup-python/src/find-python"
|
|
|
|
|
import * as finderPyPy from "setup-python/src/find-pypy"
|
2021-11-22 06:45:35 +08:00
|
|
|
// import * as path from "path"
|
2021-09-20 20:24:17 +08:00
|
|
|
|
|
|
|
|
function isPyPyVersion(versionSpec: string) {
|
|
|
|
|
return versionSpec.startsWith("pypy-")
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-22 02:46:34 +08:00
|
|
|
export async function setupActionsPython(version: string, _setupDir: string, arch: string) {
|
2021-09-20 20:24:17 +08:00
|
|
|
if (isPyPyVersion(version)) {
|
|
|
|
|
const installed = await finderPyPy.findPyPyVersion(version, arch)
|
|
|
|
|
core.info(
|
|
|
|
|
`Successfully setup PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`
|
|
|
|
|
)
|
|
|
|
|
} else {
|
|
|
|
|
const installed = await finder.findPythonVersion(version, arch)
|
|
|
|
|
core.info(`Successfully setup ${installed.impl} (${installed.version})`)
|
|
|
|
|
}
|
2021-11-22 06:45:35 +08:00
|
|
|
// fails
|
|
|
|
|
// core.info(`##[add-matcher]${path.join("./.github", "python.json")}`)
|
2021-09-20 20:24:17 +08:00
|
|
|
return undefined
|
|
|
|
|
}
|