Fix PyPy pip downgrade install state

This commit is contained in:
dajiaohuang 2026-10-22 04:44:29 +08:00
parent ec52d0af72
commit e201669395
3 changed files with 13 additions and 5 deletions

View file

@ -380,7 +380,15 @@ describe('installPyPy', () => {
expect(spyDownloadTool).toHaveBeenCalled(); expect(spyDownloadTool).toHaveBeenCalled();
expect(spyExistsSync).toHaveBeenCalled(); expect(spyExistsSync).toHaveBeenCalled();
expect(spyCacheDir).toHaveBeenCalled(); expect(spyCacheDir).toHaveBeenCalled();
expect(spyExec).toHaveBeenCalled(); expect(spyExec).toHaveBeenCalledTimes(2);
expect(spyExec).toHaveBeenNthCalledWith(
1,
expect.stringMatching(/ -m ensurepip$/)
);
expect(spyExec).toHaveBeenNthCalledWith(
2,
expect.stringMatching(/ -m pip install --upgrade pip$/)
);
}); });
it('found and install PyPy, pre-release fallback', async () => { it('found and install PyPy, pre-release fallback', async () => {

3
dist/setup/index.js vendored
View file

@ -99820,7 +99820,8 @@ async function install_pypy_installPip(pythonLocation) {
info('Installing and updating pip'); info('Installing and updating pip');
const pythonBinary = external_path_.join(pythonLocation, 'python'); const pythonBinary = external_path_.join(pythonLocation, 'python');
await exec_exec(`${pythonBinary} -m ensurepip`); await exec_exec(`${pythonBinary} -m ensurepip`);
await exec_exec(`${pythonLocation}/python -m pip install --ignore-installed pip`); // Do not use --ignore-installed; pip must remove files from previous versions.
await exec_exec(`${pythonLocation}/python -m pip install --upgrade pip`);
} }
function findRelease(releases, pythonVersion, pypyVersion, architecture, includePrerelease) { function findRelease(releases, pythonVersion, pypyVersion, architecture, includePrerelease) {
const options = { includePrerelease: includePrerelease }; const options = { includePrerelease: includePrerelease };

View file

@ -177,9 +177,8 @@ async function installPip(pythonLocation: string) {
const pythonBinary = path.join(pythonLocation, 'python'); const pythonBinary = path.join(pythonLocation, 'python');
await exec.exec(`${pythonBinary} -m ensurepip`); await exec.exec(`${pythonBinary} -m ensurepip`);
await exec.exec( // Do not use --ignore-installed; pip must remove files from previous versions.
`${pythonLocation}/python -m pip install --ignore-installed pip` await exec.exec(`${pythonLocation}/python -m pip install --upgrade pip`);
);
} }
export function findRelease( export function findRelease(