@@ -6694,7 +6694,7 @@ function run() {
66946694 core.info(`Successfully setup PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`);
66956695 }
66966696 else {
6697- const installed = yield finder.findPythonVersion (version, arch);
6697+ const installed = yield finder.useCpythonVersion (version, arch);
66986698 pythonVersion = installed.version;
66996699 core.info(`Successfully setup ${installed.impl} (${pythonVersion})`);
67006700 }
@@ -57111,7 +57111,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
5711157111 });
5711257112};
5711357113Object.defineProperty(exports, "__esModule", { value: true });
57114- exports.findPythonVersion = exports.pythonVersionToSemantic = void 0;
57114+ exports.pythonVersionToSemantic = exports.useCpythonVersion = void 0;
5711557115const os = __importStar(__webpack_require__(87));
5711657116const path = __importStar(__webpack_require__(622));
5711757117const utils_1 = __webpack_require__(163);
@@ -57139,40 +57139,6 @@ function binDir(installDir) {
5713957139 return path.join(installDir, 'bin');
5714057140 }
5714157141}
57142- // Note on the tool cache layout for PyPy:
57143- // PyPy has its own versioning scheme that doesn't follow the Python versioning scheme.
57144- // A particular version of PyPy may contain one or more versions of the Python interpreter.
57145- // For example, PyPy 7.0 contains Python 2.7, 3.5, and 3.6-alpha.
57146- // We only care about the Python version, so we don't use the PyPy version for the tool cache.
57147- function usePyPy(majorVersion, architecture) {
57148- const findPyPy = tc.find.bind(undefined, 'PyPy', majorVersion);
57149- let installDir = findPyPy(architecture);
57150- if (!installDir && utils_1.IS_WINDOWS) {
57151- // PyPy only precompiles binaries for x86, but the architecture parameter defaults to x64.
57152- // On our Windows virtual environments, we only install an x86 version.
57153- // Fall back to x86.
57154- installDir = findPyPy('x86');
57155- }
57156- if (!installDir) {
57157- // PyPy not installed in $(Agent.ToolsDirectory)
57158- throw new Error(`PyPy ${majorVersion} not found`);
57159- }
57160- // For PyPy, Windows uses 'bin', not 'Scripts'.
57161- const _binDir = path.join(installDir, 'bin');
57162- // On Linux and macOS, the Python interpreter is in 'bin'.
57163- // On Windows, it is in the installation root.
57164- const pythonLocation = utils_1.IS_WINDOWS ? installDir : _binDir;
57165- core.exportVariable('pythonLocation', pythonLocation);
57166- core.addPath(installDir);
57167- core.addPath(_binDir);
57168- // Starting from PyPy 7.3.1, the folder that is used for pip and anything that pip installs should be "Scripts" on Windows.
57169- if (utils_1.IS_WINDOWS) {
57170- core.addPath(path.join(installDir, 'Scripts'));
57171- }
57172- const impl = 'pypy' + majorVersion.toString();
57173- core.setOutput('python-version', impl);
57174- return { impl: impl, version: versionFromPath(installDir) };
57175- }
5717657142function useCpythonVersion(version, architecture) {
5717757143 return __awaiter(this, void 0, void 0, function* () {
5717857144 const desugaredVersionSpec = desugarDevVersion(version);
@@ -57222,6 +57188,7 @@ function useCpythonVersion(version, architecture) {
5722257188 return { impl: 'CPython', version: installed };
5722357189 });
5722457190}
57191+ exports.useCpythonVersion = useCpythonVersion;
5722557192/** Convert versions like `3.8-dev` to a version like `>= 3.8.0-a0`. */
5722657193function desugarDevVersion(versionSpec) {
5722757194 if (versionSpec.endsWith('-dev')) {
@@ -57248,20 +57215,6 @@ function pythonVersionToSemantic(versionSpec) {
5724857215 return versionSpec.replace(prereleaseVersion, '$1-$2');
5724957216}
5725057217exports.pythonVersionToSemantic = pythonVersionToSemantic;
57251- function findPythonVersion(version, architecture) {
57252- return __awaiter(this, void 0, void 0, function* () {
57253- switch (version.toUpperCase()) {
57254- case 'PYPY2':
57255- return usePyPy('2', architecture);
57256- case 'PYPY3':
57257- // keep pypy3 pointing to 3.6 for backward compatibility
57258- return usePyPy('3.6', architecture);
57259- default:
57260- return yield useCpythonVersion(version, architecture);
57261- }
57262- });
57263- }
57264- exports.findPythonVersion = findPythonVersion;
5726557218
5726657219
5726757220/***/ }),
0 commit comments