fix: dynamically load actions_python

This commit is contained in:
Amin Yahyaabadi 2022-04-24 16:47:52 -07:00
parent 660f362f49
commit 4f53659123
6 changed files with 178 additions and 7 deletions

174
dist/actions_python.d632f3d3.js vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/actions_python.d632f3d3.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

View File

@ -5,6 +5,7 @@ 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 "./cache"
function isPyPyVersion(versionSpec: string) { function isPyPyVersion(versionSpec: string) {
return versionSpec.startsWith("pypy-") return versionSpec.startsWith("pypy-")
@ -31,7 +32,6 @@ export async function setupActionsPython(version: string, _setupDir: string, arc
const cache = "pip" // core.getInput("cache") // package manager used for caching const cache = "pip" // core.getInput("cache") // package manager used for caching
const { cacheDependencies } = await import("./cache")
await cacheDependencies(cache, pythonVersion) await cacheDependencies(cache, pythonVersion)
} }

View File

@ -6,14 +6,13 @@ import { setupChocoPack } from "../utils/setup/setupChocoPack"
import { isGitHubCI } from "../utils/env/isci" import { isGitHubCI } from "../utils/env/isci"
import { warning } from "@actions/core" import { warning } from "@actions/core"
export function setupPython(version: string, setupDir: string, arch: string) { export async function setupPython(version: string, setupDir: string, arch: string) {
if (!isGitHubCI()) { if (!isGitHubCI()) {
// TODO parse version // TODO parse version
return setupPythonViaSystem(version, setupDir, arch) return setupPythonViaSystem(version, setupDir, arch)
} }
try { try {
// eslint-disable-next-line @typescript-eslint/no-var-requires const { setupActionsPython } = await import("./actions_python")
const { setupActionsPython } = require("./actions_python") as typeof import("./actions_python")
return setupActionsPython(version, setupDir, arch) return setupActionsPython(version, setupDir, arch)
} catch (err) { } catch (err) {
warning(err as Error) warning(err as Error)