mirror of https://github.com/aminya/setup-cpp
fix: dynamically load actions_python
This commit is contained in:
parent
660f362f49
commit
4f53659123
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
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue