Skip to content

Commit f7a9f19

Browse files
authored
Parse pypy versions on windows (#16416)
1 parent 03a3efb commit f7a9f19

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/client/pythonEnvironments/discovery/locators/services/pyenvLocator.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,15 @@ function getKnownPyenvVersionParsers(): Map<string, (path: string) => Promise<IP
169169

170170
if (
171171
parts.length === 3 &&
172-
(parts[2].startsWith('src') || parts[2].startsWith('beta') || parts[2].startsWith('alpha'))
172+
(parts[2].startsWith('src') ||
173+
parts[2].startsWith('beta') ||
174+
parts[2].startsWith('alpha') ||
175+
parts[2].startsWith('win64'))
173176
) {
177+
const part1 = parts[1].startsWith('v') ? parts[1].substr(1) : parts[1];
174178
return Promise.resolve({
175179
pythonVer,
176-
distroVer: `${parts[1]}-${parts[2]}`,
180+
distroVer: `${part1}-${parts[2]}`,
177181
distro: 'pypy',
178182
});
179183
}

src/test/pythonEnvironments/discovery/locators/pyenvLocator.unit.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,14 @@ suite('Pyenv Versions Parser Test', () => {
248248
{ input: 'pypy3.5-5.7.1-beta', expectedOutput: { pythonVer: '3.5', distro: 'pypy', distroVer: '5.7.1-beta' } },
249249
{ input: 'pypy3.6-7.3.1-src', expectedOutput: { pythonVer: '3.6', distro: 'pypy', distroVer: '7.3.1-src' } },
250250
{ input: 'pypy3.6-7.3.1', expectedOutput: { pythonVer: '3.6', distro: 'pypy', distroVer: '7.3.1' } },
251+
{
252+
input: 'pypy3.7-v7.3.5rc3-win64',
253+
expectedOutput: { pythonVer: '3.7', distro: 'pypy', distroVer: '7.3.5rc3-win64' },
254+
},
255+
{
256+
input: 'pypy3.7-v7.3.5-win64',
257+
expectedOutput: { pythonVer: '3.7', distro: 'pypy', distroVer: '7.3.5-win64' },
258+
},
251259
{
252260
input: 'pypy-5.7.1-beta-src',
253261
expectedOutput: { pythonVer: undefined, distro: 'pypy', distroVer: '5.7.1-beta-src' },

0 commit comments

Comments
 (0)