|
1 | 1 | import * as core from "@actions/core"
|
2 | 2 | import * as finder from "setup-python/src/find-python"
|
3 | 3 | import * as finderPyPy from "setup-python/src/find-pypy"
|
4 |
| -// import * as path from "path" |
| 4 | +// import { getCacheDistributor } from "setup-python/src/cache-distributions/cache-factory" |
| 5 | +// import { isGhes } from "setup-python/src/utils" |
5 | 6 |
|
6 | 7 | function isPyPyVersion(versionSpec: string) {
|
7 | 8 | return versionSpec.startsWith("pypy-")
|
8 | 9 | }
|
9 | 10 |
|
| 11 | +// // @ts-ignore |
| 12 | +// async function cacheDependencies(cache: string, pythonVersion: string) { |
| 13 | +// if (isGhes()) { |
| 14 | +// throw new Error("Caching is not supported on GHES") |
| 15 | +// } |
| 16 | +// const cacheDependencyPath = core.getInput("cache-dependency-path") || undefined |
| 17 | +// const cacheDistributor = getCacheDistributor(cache, pythonVersion, cacheDependencyPath) |
| 18 | +// await cacheDistributor.restoreCache() |
| 19 | +// } |
| 20 | + |
10 | 21 | export async function setupActionsPython(version: string, _setupDir: string, arch: string) {
|
| 22 | + let pythonVersion: string |
11 | 23 | if (isPyPyVersion(version)) {
|
12 | 24 | const installed = await finderPyPy.findPyPyVersion(version, arch)
|
| 25 | + pythonVersion = `${installed.resolvedPyPyVersion}-${installed.resolvedPythonVersion}` |
13 | 26 | core.info(
|
14 | 27 | `Successfully setup PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`
|
15 | 28 | )
|
16 | 29 | } else {
|
17 | 30 | const installed = await finder.findPythonVersion(version, arch)
|
18 |
| - core.info(`Successfully setup ${installed.impl} (${installed.version})`) |
| 31 | + pythonVersion = installed.version |
| 32 | + core.info(`Successfully setup ${installed.impl} (${pythonVersion})`) |
19 | 33 | }
|
| 34 | + |
| 35 | + // const cache = core.getInput("cache") |
| 36 | + // if (cache) { |
| 37 | + // await cacheDependencies(cache, pythonVersion) |
| 38 | + // } |
| 39 | + |
20 | 40 | // fails
|
| 41 | + // const matchersPath = path.join(__dirname, '../..', '.github'); |
| 42 | + // core.info(`##[add-matcher]${path.join(matchersPath, 'python.json')}`); |
21 | 43 | // core.info(`##[add-matcher]${path.join("./.github", "python.json")}`)
|
| 44 | + |
22 | 45 | return undefined
|
23 | 46 | }
|
0 commit comments