Skip to content

Commit f21f0db

Browse files
committed
fix: update actions_python entry file
Based on https://github.com/actions/setup-python/blob/main/src/setup-python.ts
1 parent 2a35ca7 commit f21f0db

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed

dist/setup_cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/setup_cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/python/actions_python.ts

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,46 @@
11
import * as core from "@actions/core"
22
import * as finder from "setup-python/src/find-python"
33
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"
56

67
function isPyPyVersion(versionSpec: string) {
78
return versionSpec.startsWith("pypy-")
89
}
910

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+
1021
export async function setupActionsPython(version: string, _setupDir: string, arch: string) {
22+
let pythonVersion: string
1123
if (isPyPyVersion(version)) {
1224
const installed = await finderPyPy.findPyPyVersion(version, arch)
25+
pythonVersion = `${installed.resolvedPyPyVersion}-${installed.resolvedPythonVersion}`
1326
core.info(
1427
`Successfully setup PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`
1528
)
1629
} else {
1730
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})`)
1933
}
34+
35+
// const cache = core.getInput("cache")
36+
// if (cache) {
37+
// await cacheDependencies(cache, pythonVersion)
38+
// }
39+
2040
// fails
41+
// const matchersPath = path.join(__dirname, '../..', '.github');
42+
// core.info(`##[add-matcher]${path.join(matchersPath, 'python.json')}`);
2143
// core.info(`##[add-matcher]${path.join("./.github", "python.json")}`)
44+
2245
return undefined
2346
}

0 commit comments

Comments
 (0)