Skip to content

Commit

Permalink
fix: update setup-python
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Jun 26, 2022
1 parent ba38187 commit 5692a92
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 48 deletions.
2 changes: 2 additions & 0 deletions dist/actions_python.678f52ec.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/actions_python.678f52ec.js.map

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions dist/actions_python.f691d232.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/actions_python.f691d232.js.map

This file was deleted.

2 changes: 1 addition & 1 deletion dist/setup_cpp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/setup_cpp.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"msvc-dev-cmd": "github:aminya/msvc-dev-cmd#9f672c1",
"numerous": "1.0.3",
"semver": "7.3.7",
"setup-python": "github:actions/setup-python#v4.0.0",
"setup-python": "github:actions/setup-python#ffcd00020c213885323d35524aa155f17870b8dd",
"time-delta": "github:aminya/time-delta#69d91a41cef28e569be9a2991129f5f7d1f0d00e",
"ubuntu-version": "^2.0.0",
"untildify": "^4.0.0",
Expand Down
72 changes: 36 additions & 36 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 28 additions & 6 deletions src/python/actions_python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,48 @@ import { isGitHubCI } from "../utils/env/isci"
import { cacheDependencies } from "./actions_cache"

function isPyPyVersion(versionSpec: string) {
return versionSpec.startsWith("pypy-")
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 setupActionsPython(version: string, _setupDir: string, arch: string) {
if (process.env.AGENT_TOOLSDIRECTORY?.trim()) {
debug(`Python is expected to be installed into AGENT_TOOLSDIRECTORY=${process.env.AGENT_TOOLSDIRECTORY}`)
process.env.RUNNER_TOOL_CACHE = process.env.AGENT_TOOLSDIRECTORY
debug(`Python is expected to be installed into AGENT_TOOLSDIRECTORY=${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)
if (version) {
let pythonVersion: string
if (isPyPyVersion(version)) {
const installed = await findPyPyVersion(version, arch)
pythonVersion = `${installed.resolvedPyPyVersion}-${installed.resolvedPythonVersion}`
info(`Successfully setup PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`)
info(`Successfully set up PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`)
} else {
const installed = await useCpythonVersion(version, arch)
pythonVersion = installed.version
info(`Successfully setup ${installed.impl} (${pythonVersion})`)
info(`Successfully set up ${installed.impl} (${pythonVersion})`)
}

const cache = "pip" // core.getInput("cache") // package manager used for caching
Expand Down

0 comments on commit 5692a92

Please sign in to comment.