mirror of https://github.com/aminya/setup-cpp
fix: update setup-python to v3.1.2
This commit is contained in:
parent
fe36759e27
commit
0f42dc4b13
|
@ -42,7 +42,7 @@
|
||||||
"msvc-dev-cmd": "github:aminya/msvc-dev-cmd#9f672c1",
|
"msvc-dev-cmd": "github:aminya/msvc-dev-cmd#9f672c1",
|
||||||
"numerous": "1.0.3",
|
"numerous": "1.0.3",
|
||||||
"semver": "7.3.7",
|
"semver": "7.3.7",
|
||||||
"setup-python": "github:actions/setup-python#7f80679172b057fc5e90d70d197929d454754a5a",
|
"setup-python": "github:actions/setup-python#v3.1.2",
|
||||||
"time-delta": "github:aminya/time-delta#69d91a41cef28e569be9a2991129f5f7d1f0d00e",
|
"time-delta": "github:aminya/time-delta#69d91a41cef28e569be9a2991129f5f7d1f0d00e",
|
||||||
"untildify": "^4.0.0",
|
"untildify": "^4.0.0",
|
||||||
"which": "^2.0.2"
|
"which": "^2.0.2"
|
||||||
|
|
|
@ -1,43 +1,53 @@
|
||||||
import * as finder from "setup-python/src/find-python"
|
import * as finder from "setup-python/src/find-python"
|
||||||
import * as finderPyPy from "setup-python/src/find-pypy"
|
import * as finderPyPy from "setup-python/src/find-pypy"
|
||||||
import { existsSync } from "fs"
|
import { existsSync } from "fs"
|
||||||
import { warning } from "../utils/io/io"
|
import { info, warning } from "../utils/io/io"
|
||||||
import { info } from "@actions/core"
|
import * as core from "@actions/core"
|
||||||
import path from "path"
|
import path from "path"
|
||||||
import { isGitHubCI } from "../utils/env/isci"
|
import { isGitHubCI } from "../utils/env/isci"
|
||||||
// import { getCacheDistributor } from "setup-python/src/cache-distributions/cache-factory"
|
import { isCacheFeatureAvailable } from "setup-python/src/utils"
|
||||||
// import { isGhes } from "setup-python/src/utils"
|
import { getCacheDistributor } from "setup-python/src/cache-distributions/cache-factory"
|
||||||
|
|
||||||
function isPyPyVersion(versionSpec: string) {
|
function isPyPyVersion(versionSpec: string) {
|
||||||
return versionSpec.startsWith("pypy-")
|
return versionSpec.startsWith("pypy-")
|
||||||
}
|
}
|
||||||
|
|
||||||
// // @ts-ignore
|
async function cacheDependencies(cache: string, pythonVersion: string) {
|
||||||
// async function cacheDependencies(cache: string, pythonVersion: string) {
|
const cacheDependencyPath = undefined // core.getInput("cache-dependency-path") || undefined
|
||||||
// if (isGhes()) {
|
const cacheDistributor = getCacheDistributor(cache, pythonVersion, cacheDependencyPath)
|
||||||
// throw new Error("Caching is not supported on GHES")
|
await cacheDistributor.restoreCache()
|
||||||
// }
|
}
|
||||||
// const cacheDependencyPath = core.getInput("cache-dependency-path") || undefined
|
|
||||||
// const cacheDistributor = getCacheDistributor(cache, pythonVersion, cacheDependencyPath)
|
|
||||||
// await cacheDistributor.restoreCache()
|
|
||||||
// }
|
|
||||||
|
|
||||||
export async function setupActionsPython(version: string, _setupDir: string, arch: string) {
|
export async function setupActionsPython(version: string, _setupDir: string, arch: string) {
|
||||||
|
if (process.env.AGENT_TOOLSDIRECTORY?.trim()) {
|
||||||
|
core.debug(`Python is expected to be installed into AGENT_TOOLSDIRECTORY=${process.env.AGENT_TOOLSDIRECTORY}`)
|
||||||
|
process.env.RUNNER_TOOL_CACHE = process.env.AGENT_TOOLSDIRECTORY
|
||||||
|
} else {
|
||||||
|
core.debug(`Python is expected to be installed into RUNNER_TOOL_CACHE==${process.env.RUNNER_TOOL_CACHE}`)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (version) {
|
||||||
let pythonVersion: string
|
let pythonVersion: string
|
||||||
if (isPyPyVersion(version)) {
|
if (isPyPyVersion(version)) {
|
||||||
const installed = await finderPyPy.findPyPyVersion(version, arch)
|
const installed = await finderPyPy.findPyPyVersion(version, arch)
|
||||||
pythonVersion = `${installed.resolvedPyPyVersion}-${installed.resolvedPythonVersion}`
|
pythonVersion = `${installed.resolvedPyPyVersion}-${installed.resolvedPythonVersion}`
|
||||||
info(`Successfully setup PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`)
|
info(
|
||||||
|
`Successfully setup PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
const installed = await finder.findPythonVersion(version, arch)
|
const installed = await finder.useCpythonVersion(version, arch)
|
||||||
pythonVersion = installed.version
|
pythonVersion = installed.version
|
||||||
info(`Successfully setup ${installed.impl} (${pythonVersion})`)
|
info(`Successfully setup ${installed.impl} (${pythonVersion})`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// const cache = core.getInput("cache")
|
const cache = "pip" // core.getInput("cache") // package manager used for caching
|
||||||
// if (cache) {
|
if (isCacheFeatureAvailable()) {
|
||||||
// await cacheDependencies(cache, pythonVersion)
|
await cacheDependencies(cache, pythonVersion)
|
||||||
// }
|
}
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
core.setFailed((err as Error).message)
|
||||||
|
}
|
||||||
|
|
||||||
if (isGitHubCI()) {
|
if (isGitHubCI()) {
|
||||||
addPythonLoggingMatcher()
|
addPythonLoggingMatcher()
|
||||||
|
|
Loading…
Reference in New Issue