diff --git a/__tests__/install-pypy.test.ts b/__tests__/install-pypy.test.ts index a9994c42..17029ccf 100644 --- a/__tests__/install-pypy.test.ts +++ b/__tests__/install-pypy.test.ts @@ -380,7 +380,15 @@ describe('installPyPy', () => { expect(spyDownloadTool).toHaveBeenCalled(); expect(spyExistsSync).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 () => { diff --git a/dist/setup/index.js b/dist/setup/index.js index 21eebcaa..dd7f04c6 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -99820,7 +99820,8 @@ async function install_pypy_installPip(pythonLocation) { info('Installing and updating pip'); const pythonBinary = external_path_.join(pythonLocation, 'python'); 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) { const options = { includePrerelease: includePrerelease }; diff --git a/src/install-pypy.ts b/src/install-pypy.ts index 43816f51..1dccfc20 100644 --- a/src/install-pypy.ts +++ b/src/install-pypy.ts @@ -177,9 +177,8 @@ async function installPip(pythonLocation: string) { const pythonBinary = path.join(pythonLocation, 'python'); 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`); } export function findRelease(