Skip to content

Commit 9a8a6ba

Browse files
authored
do not use unsupported RYE_TOOLCHAIN_VERSION (#339)
1 parent 74af863 commit 9a8a6ba

File tree

3 files changed

+30
-9
lines changed

3 files changed

+30
-9
lines changed

dist/setup/index.js

Lines changed: 13 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/setup/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/setup-rye.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,25 @@ async function installRye(
128128
}
129129

130130
async function determineToolchainVersion(): Promise<string | void> {
131+
const supportedMinorVersions = ['9', '10', '11', '12']
131132
const pythonVersionFile = `${WORKING_DIR_PATH}${path.sep}.python-version`
132133
if (fs.existsSync(pythonVersionFile)) {
133-
const toolchainVersion = await fs.promises.readFile(
134-
pythonVersionFile,
135-
'utf8'
134+
const fileContent = await fs.promises.readFile(pythonVersionFile, 'utf8')
135+
const toolchainVersion = fileContent.trim()
136+
if (
137+
toolchainVersion.startsWith('cpython@3') ||
138+
toolchainVersion.startsWith('3')
139+
) {
140+
const minorVersion = toolchainVersion.split('.')[1]
141+
if (supportedMinorVersions.includes(minorVersion)) {
142+
core.info(`Determined RYE_TOOLCHAIN_VERSION: ${toolchainVersion}`)
143+
return toolchainVersion
144+
}
145+
}
146+
core.warning(
147+
`Unsupported version in .python-version: ${toolchainVersion}, using default RYE_TOOLCHAIN_VERSION`
136148
)
137-
core.info(`Determined RYE_TOOLCHAIN_VERSION: ${toolchainVersion.trim()}`)
138-
return toolchainVersion.trim()
149+
return
139150
}
140151
core.warning(
141152
`No .python-version file found, using default RYE_TOOLCHAIN_VERSION`

0 commit comments

Comments
 (0)