Skip to content

Commit

Permalink
do not use unsupported RYE_TOOLCHAIN_VERSION (#339)
Browse files Browse the repository at this point in the history
  • Loading branch information
eifinger authored Sep 17, 2024
1 parent 74af863 commit 9a8a6ba
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 9 deletions.
16 changes: 13 additions & 3 deletions dist/setup/index.js

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

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

Large diffs are not rendered by default.

21 changes: 16 additions & 5 deletions src/setup-rye.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,25 @@ async function installRye(
}

async function determineToolchainVersion(): Promise<string | void> {
const supportedMinorVersions = ['9', '10', '11', '12']
const pythonVersionFile = `${WORKING_DIR_PATH}${path.sep}.python-version`
if (fs.existsSync(pythonVersionFile)) {
const toolchainVersion = await fs.promises.readFile(
pythonVersionFile,
'utf8'
const fileContent = await fs.promises.readFile(pythonVersionFile, 'utf8')
const toolchainVersion = fileContent.trim()
if (
toolchainVersion.startsWith('cpython@3') ||
toolchainVersion.startsWith('3')
) {
const minorVersion = toolchainVersion.split('.')[1]
if (supportedMinorVersions.includes(minorVersion)) {
core.info(`Determined RYE_TOOLCHAIN_VERSION: ${toolchainVersion}`)
return toolchainVersion
}
}
core.warning(
`Unsupported version in .python-version: ${toolchainVersion}, using default RYE_TOOLCHAIN_VERSION`
)
core.info(`Determined RYE_TOOLCHAIN_VERSION: ${toolchainVersion.trim()}`)
return toolchainVersion.trim()
return
}
core.warning(
`No .python-version file found, using default RYE_TOOLCHAIN_VERSION`
Expand Down

0 comments on commit 9a8a6ba

Please sign in to comment.