fix: update setup-python

This commit is contained in:
Amin Yahyaabadi 2022-07-05 20:56:51 -07:00
parent af7919aa41
commit ed9b316d01
10 changed files with 54 additions and 49 deletions

2
dist/actions_python.239cf807.js vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/actions_python.239cf807.js.map vendored Normal file

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

2
dist/setup_cpp.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -49,7 +49,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#ffcd00020c213885323d35524aa155f17870b8dd", "setup-python": "github:actions/setup-python#f0bcf8be037eba11327da6eaf40cd99a2a092494",
"time-delta": "github:aminya/time-delta#69d91a41cef28e569be9a2991129f5f7d1f0d00e", "time-delta": "github:aminya/time-delta#69d91a41cef28e569be9a2991129f5f7d1f0d00e",
"ubuntu-version": "^2.0.0", "ubuntu-version": "^2.0.0",
"untildify": "^4.0.0", "untildify": "^4.0.0",

View File

@ -38,7 +38,7 @@ specifiers:
prettier: 2.7.1 prettier: 2.7.1
prettier-config-atomic: ^3.0.10 prettier-config-atomic: ^3.0.10
semver: 7.3.7 semver: 7.3.7
setup-python: github:actions/setup-python#ffcd00020c213885323d35524aa155f17870b8dd setup-python: github:actions/setup-python#f0bcf8be037eba11327da6eaf40cd99a2a092494
shx: 0.3.4 shx: 0.3.4
terser-config-atomic: ^0.1.1 terser-config-atomic: ^0.1.1
time-delta: github:aminya/time-delta#69d91a41cef28e569be9a2991129f5f7d1f0d00e time-delta: github:aminya/time-delta#69d91a41cef28e569be9a2991129f5f7d1f0d00e
@ -59,7 +59,7 @@ dependencies:
msvc-dev-cmd: github.com/aminya/msvc-dev-cmd/9f672c1 msvc-dev-cmd: github.com/aminya/msvc-dev-cmd/9f672c1
numerous: 1.0.3 numerous: 1.0.3
semver: 7.3.7 semver: 7.3.7
setup-python: github.com/actions/setup-python/ffcd00020c213885323d35524aa155f17870b8dd setup-python: github.com/actions/setup-python/f0bcf8be037eba11327da6eaf40cd99a2a092494
time-delta: github.com/aminya/time-delta/69d91a41cef28e569be9a2991129f5f7d1f0d00e time-delta: github.com/aminya/time-delta/69d91a41cef28e569be9a2991129f5f7d1f0d00e
ubuntu-version: 2.0.0 ubuntu-version: 2.0.0
untildify: 4.0.0 untildify: 4.0.0
@ -92,8 +92,8 @@ devDependencies:
packages: packages:
/@actions/cache/2.0.6: /@actions/cache/3.0.0:
resolution: {integrity: sha512-Z39ZrWaTRRPaV/AOQdY7hve+Iy/HloH5prpz+k+0lZgGQs/3SeO0UYSIakVuXOk2pdMZnl0Nv0PoK1rmh9YfGQ==} resolution: {integrity: sha512-GL9CT1Fnu+pqs8TTB621q8Xa8Cilw2n9MwvbgMedetH7L1q2n6jY61gzbwGbKgtVbp3gVJ12aNMi4osSGXx3KQ==}
dependencies: dependencies:
'@actions/core': 1.9.0 '@actions/core': 1.9.0
'@actions/exec': 1.1.1 '@actions/exec': 1.1.1
@ -8192,12 +8192,12 @@ packages:
readable-stream: 3.6.0 readable-stream: 3.6.0
dev: true dev: true
github.com/actions/setup-python/ffcd00020c213885323d35524aa155f17870b8dd: github.com/actions/setup-python/f0bcf8be037eba11327da6eaf40cd99a2a092494:
resolution: {tarball: https://codeload.github.com/actions/setup-python/tar.gz/ffcd00020c213885323d35524aa155f17870b8dd} resolution: {tarball: https://codeload.github.com/actions/setup-python/tar.gz/f0bcf8be037eba11327da6eaf40cd99a2a092494}
name: setup-python name: setup-python
version: 4.0.0 version: 4.0.0
dependencies: dependencies:
'@actions/cache': 2.0.6 '@actions/cache': 3.0.0
'@actions/core': 1.9.0 '@actions/core': 1.9.0
'@actions/exec': 1.1.1 '@actions/exec': 1.1.1
'@actions/glob': 0.2.1 '@actions/glob': 0.2.1

View File

@ -1,10 +0,0 @@
import { isCacheFeatureAvailable } from "setup-python/src/utils"
import { getCacheDistributor } from "setup-python/src/cache-distributions/cache-factory"
export async function cacheDependencies(cache: string, pythonVersion: string) {
if (isCacheFeatureAvailable()) {
const cacheDependencyPath = undefined // core.getInput("cache-dependency-path") || undefined
const cacheDistributor = getCacheDistributor(cache, pythonVersion, cacheDependencyPath)
await cacheDistributor.restoreCache()
}
}

View File

@ -5,56 +5,71 @@ import { info, warning } from "../utils/io/io"
import { debug } from "@actions/core" import { debug } from "@actions/core"
import path from "path" import path from "path"
import { isGitHubCI } from "../utils/env/isci" import { isGitHubCI } from "../utils/env/isci"
import { cacheDependencies } from "./actions_cache" import { isCacheFeatureAvailable, IS_LINUX, IS_WINDOWS } 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")
} }
// function resolveVersionInput(version: string): string { /*
// let versionFile = getInput("python-version-file") function resolveVersionInput(version: string): string {
let versionFile = getInput("python-version-file")
// if (version && versionFile) { if (version && versionFile) {
// warning("Both python-version and python-version-file inputs are specified, only python-version will be used") warning("Both python-version and python-version-file inputs are specified, only python-version will be used")
// } }
// if (version) { if (version) {
// return version return version
// } }
// versionFile = versionFile || ".python-version" versionFile = versionFile || ".python-version"
// if (!existsSync(versionFile)) { if (!existsSync(versionFile)) {
// throw new Error(`The specified python version file at: ${versionFile} does not exist`) throw new Error(`The specified python version file at: ${versionFile} does not exist`)
// } }
// version = readFileSync(versionFile, "utf8") version = readFileSync(versionFile, "utf8")
// info(`Resolved ${versionFile} as ${version}`) info(`Resolved ${versionFile} as ${version}`)
// return version return version
// } }
*/
export async function cacheDependencies(cache: string, pythonVersion: string) {
const cacheDependencyPath = undefined // 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()) { // According to the README windows binaries do not require to be installed
debug(`Python is expected to be installed into AGENT_TOOLSDIRECTORY=${process.env.AGENT_TOOLSDIRECTORY}`) // 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 {
process.env.AGENT_TOOLSDIRECTORY = "/Users/runner/hostedtoolcache"
}
process.env.RUNNER_TOOL_CACHE = process.env.AGENT_TOOLSDIRECTORY process.env.RUNNER_TOOL_CACHE = process.env.AGENT_TOOLSDIRECTORY
} else {
debug(`Python is expected to be installed into RUNNER_TOOL_CACHE==${process.env.RUNNER_TOOL_CACHE}`)
} }
debug(`Python is expected to be installed into RUNNER_TOOL_CACHE=${process.env.RUNNER_TOOL_CACHE}`)
// const version = resolveVersionInput(versionGiven) // const version = resolveVersionInput(versionGiven)
if (version) { if (version) {
let pythonVersion: string let pythonVersion: string
if (isPyPyVersion(version)) { if (isPyPyVersion(version)) {
const installed = await findPyPyVersion(version, arch) const installed = await findPyPyVersion(version, arch, true)
pythonVersion = `${installed.resolvedPyPyVersion}-${installed.resolvedPythonVersion}` pythonVersion = `${installed.resolvedPyPyVersion}-${installed.resolvedPythonVersion}`
info(`Successfully set up PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`) info(`Successfully set up PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`)
} else { } else {
const installed = await useCpythonVersion(version, arch) const installed = await useCpythonVersion(version, arch, true)
pythonVersion = installed.version pythonVersion = installed.version
info(`Successfully set up ${installed.impl} (${pythonVersion})`) info(`Successfully set up ${installed.impl} (${pythonVersion})`)
} }
const cache = "pip" // core.getInput("cache") // package manager used for caching if (isCacheFeatureAvailable()) {
const cache = "pip" // core.getInput("cache") // package manager used for caching
await cacheDependencies(cache, pythonVersion) await cacheDependencies(cache, pythonVersion)
}
} }
if (isGitHubCI()) { if (isGitHubCI()) {