mirror of https://github.com/aminya/setup-cpp
fix: update setup-python
This commit is contained in:
parent
453df99f1c
commit
9d1119edc9
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -65,8 +65,8 @@
|
|||
"msvc-dev-cmd": "github:aminya/msvc-dev-cmd#9f672c1",
|
||||
"numerous": "1.0.3",
|
||||
"patha": "^0.4.1",
|
||||
"setup-python": "github:actions/setup-python#c474c82340438924daab9282d07300bfe7e3692d",
|
||||
"semver": "7.3.8",
|
||||
"setup-python": "github:actions/setup-python#v4.3.0",
|
||||
"time-delta": "github:aminya/time-delta#69d91a41cef28e569be9a2991129f5f7d1f0d00e",
|
||||
"ubuntu-version": "^2.0.0",
|
||||
"untildify-user": "workspace:1.0.0",
|
||||
|
|
2148
pnpm-lock.yaml
2148
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
@ -5,69 +5,47 @@ import { info, warning } from "ci-log"
|
|||
import { debug } from "@actions/core"
|
||||
import { join } from "patha"
|
||||
import ciDetect from "@npmcli/ci-detect"
|
||||
import { isCacheFeatureAvailable, IS_LINUX, IS_WINDOWS } from "setup-python/src/utils"
|
||||
import { isCacheFeatureAvailable, IS_MAC } from "setup-python/src/utils"
|
||||
import { getCacheDistributor } from "setup-python/src/cache-distributions/cache-factory"
|
||||
|
||||
function isPyPyVersion(versionSpec: string) {
|
||||
return versionSpec.startsWith("pypy")
|
||||
}
|
||||
|
||||
/*
|
||||
function resolveVersionInput(version: string): string {
|
||||
let versionFile = getInput("python-version-file")
|
||||
|
||||
if (version && versionFile) {
|
||||
warning("Both python-version and python-version-file inputs are specified, only python-version will be used")
|
||||
}
|
||||
|
||||
if (version) {
|
||||
return version
|
||||
}
|
||||
|
||||
versionFile = versionFile || ".python-version"
|
||||
if (!existsSync(versionFile)) {
|
||||
throw new Error(`The specified python version file at: ${versionFile} does not exist`)
|
||||
}
|
||||
version = readFileSync(versionFile, "utf8")
|
||||
info(`Resolved ${versionFile} as ${version}`)
|
||||
|
||||
return version
|
||||
}
|
||||
*/
|
||||
|
||||
export async function cacheDependencies(cache: string, pythonVersion: string) {
|
||||
const cacheDependencyPath = undefined // core.getInput("cache-dependency-path") || undefined
|
||||
const cacheDependencyPath = undefined
|
||||
const cacheDistributor = getCacheDistributor(cache, pythonVersion, cacheDependencyPath)
|
||||
await cacheDistributor.restoreCache()
|
||||
}
|
||||
|
||||
const checkLatest = false
|
||||
|
||||
export async function setupActionsPython(version: string, _setupDir: string, arch: string) {
|
||||
// According to the README windows binaries do not require to be installed
|
||||
// in the specific location, but Mac and Linux do
|
||||
if (!IS_WINDOWS && !process.env.AGENT_TOOLSDIRECTORY?.trim()) {
|
||||
if (IS_LINUX) {
|
||||
process.env.AGENT_TOOLSDIRECTORY = "/opt/hostedtoolcache"
|
||||
} else {
|
||||
if (IS_MAC) {
|
||||
process.env.AGENT_TOOLSDIRECTORY = "/Users/runner/hostedtoolcache"
|
||||
}
|
||||
|
||||
const agent_toolsdirectory = process.env.AGENT_TOOLSDIRECTORY?.trim()
|
||||
if (typeof agent_toolsdirectory === "string" && agent_toolsdirectory !== "") {
|
||||
process.env.RUNNER_TOOL_CACHE = process.env.AGENT_TOOLSDIRECTORY
|
||||
}
|
||||
debug(`Python is expected to be installed into RUNNER_TOOL_CACHE=${process.env.RUNNER_TOOL_CACHE}`)
|
||||
// const version = resolveVersionInput(versionGiven)
|
||||
|
||||
debug(`Python is expected to be installed into ${process.env.RUNNER_TOOL_CACHE}`)
|
||||
|
||||
if (version) {
|
||||
let pythonVersion: string
|
||||
if (isPyPyVersion(version)) {
|
||||
const installed = await findPyPyVersion(version, arch, true)
|
||||
const installed = await findPyPyVersion(version, arch, true, checkLatest)
|
||||
pythonVersion = `${installed.resolvedPyPyVersion}-${installed.resolvedPythonVersion}`
|
||||
info(`Successfully set up PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`)
|
||||
} else {
|
||||
const installed = await useCpythonVersion(version, arch, true)
|
||||
const installed = await useCpythonVersion(version, arch, true, checkLatest)
|
||||
pythonVersion = installed.version
|
||||
info(`Successfully set up ${installed.impl} (${pythonVersion})`)
|
||||
}
|
||||
|
||||
if (isCacheFeatureAvailable()) {
|
||||
const cache = "pip" // core.getInput("cache") // package manager used for caching
|
||||
const cache = "pip" // package manager used for caching
|
||||
await cacheDependencies(cache, pythonVersion)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"compilerOptions": {
|
||||
"strict": true,
|
||||
"strictNullChecks": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedLocals": false,
|
||||
"noUnusedParameters": true,
|
||||
"noImplicitReturns": true,
|
||||
"noImplicitAny": true,
|
||||
|
|
Loading…
Reference in New Issue