@@ -1108,10 +1108,6 @@ function findPyPyVersion(versionSpec, architecture) {
11081108 let resolvedPythonVersion = '' ;
11091109 let installDir ;
11101110 const pypyVersionSpec = parsePyPyVersion ( versionSpec ) ;
1111- // PyPy only precompiles binaries for x86, but the architecture parameter defaults to x64.
1112- if ( utils_1 . IS_WINDOWS && architecture === 'x64' ) {
1113- architecture = 'x86' ;
1114- }
11151111 ( { installDir, resolvedPythonVersion, resolvedPyPyVersion } = findPyPyToolCache ( pypyVersionSpec . pythonVersion , pypyVersionSpec . pypyVersion , architecture ) ) ;
11161112 if ( ! installDir ) {
11171113 ( {
@@ -1133,7 +1129,9 @@ exports.findPyPyVersion = findPyPyVersion;
11331129function findPyPyToolCache ( pythonVersion , pypyVersion , architecture ) {
11341130 let resolvedPyPyVersion = '' ;
11351131 let resolvedPythonVersion = '' ;
1136- let installDir = tc . find ( 'PyPy' , pythonVersion , architecture ) ;
1132+ let installDir = utils_1 . IS_WINDOWS
1133+ ? findPyPyInstallDirForWindows ( pythonVersion )
1134+ : tc . find ( 'PyPy' , pythonVersion , architecture ) ;
11371135 if ( installDir ) {
11381136 // 'tc.find' finds tool based on Python version but we also need to check
11391137 // whether PyPy version satisfies requested version.
@@ -1177,6 +1175,12 @@ function parsePyPyVersion(versionSpec) {
11771175 } ;
11781176}
11791177exports . parsePyPyVersion = parsePyPyVersion ;
1178+ function findPyPyInstallDirForWindows ( pythonVersion ) {
1179+ let installDir = '' ;
1180+ utils_1 . WINDOWS_ARCHS . forEach ( architecture => ( installDir = installDir || tc . find ( 'PyPy' , pythonVersion , architecture ) ) ) ;
1181+ return installDir ;
1182+ }
1183+ exports . findPyPyInstallDirForWindows = findPyPyInstallDirForWindows ;
11801184
11811185
11821186/***/ } ) ,
@@ -2327,6 +2331,8 @@ const path = __importStar(__webpack_require__(622));
23272331const semver = __importStar ( __webpack_require__ ( 876 ) ) ;
23282332exports . IS_WINDOWS = process . platform === 'win32' ;
23292333exports . IS_LINUX = process . platform === 'linux' ;
2334+ exports . WINDOWS_ARCHS = [ 'x86' , 'x64' ] ;
2335+ exports . WINDOWS_PLATFORMS = [ 'win32' , 'win64' ] ;
23302336const PYPY_VERSION_FILE = 'PYPY_VERSION' ;
23312337/** create Symlinks for downloaded PyPy
23322338 * It should be executed only for downloaded versions in runtime, because
@@ -2893,7 +2899,9 @@ function findRelease(releases, pythonVersion, pypyVersion, architecture) {
28932899 const isPyPyVersionSatisfied = isPyPyNightly ||
28942900 semver . satisfies ( pypyVersionToSemantic ( item . pypy_version ) , pypyVersion ) ;
28952901 const isArchPresent = item . files &&
2896- item . files . some ( file => file . arch === architecture && file . platform === process . platform ) ;
2902+ ( utils_1 . IS_WINDOWS
2903+ ? isArchPresentForWindows ( item )
2904+ : isArchPresentForMacOrLinux ( item , architecture , process . platform ) ) ;
28972905 return isPythonVersionSatisfied && isPyPyVersionSatisfied && isArchPresent ;
28982906 } ) ;
28992907 if ( filterReleases . length === 0 ) {
@@ -2904,7 +2912,9 @@ function findRelease(releases, pythonVersion, pypyVersion, architecture) {
29042912 semver . compare ( semver . coerce ( current . python_version ) , semver . coerce ( previous . python_version ) ) ) ;
29052913 } ) ;
29062914 const foundRelease = sortedReleases [ 0 ] ;
2907- const foundAsset = foundRelease . files . find ( item => item . arch === architecture && item . platform === process . platform ) ;
2915+ const foundAsset = utils_1 . IS_WINDOWS
2916+ ? findAssetForWindows ( foundRelease )
2917+ : findAssetForMacOrLinux ( foundRelease , architecture , process . platform ) ;
29082918 return {
29092919 foundAsset,
29102920 resolvedPythonVersion : foundRelease . python_version ,
@@ -2926,6 +2936,24 @@ function pypyVersionToSemantic(versionSpec) {
29262936 return versionSpec . replace ( prereleaseVersion , '$1-$2.$3' ) ;
29272937}
29282938exports . pypyVersionToSemantic = pypyVersionToSemantic ;
2939+ function isArchPresentForWindows ( item ) {
2940+ return item . files . some ( ( file ) => utils_1 . WINDOWS_ARCHS . includes ( file . arch ) &&
2941+ utils_1 . WINDOWS_PLATFORMS . includes ( file . platform ) ) ;
2942+ }
2943+ exports . isArchPresentForWindows = isArchPresentForWindows ;
2944+ function isArchPresentForMacOrLinux ( item , architecture , platform ) {
2945+ return item . files . some ( ( file ) => file . arch === architecture && file . platform === platform ) ;
2946+ }
2947+ exports . isArchPresentForMacOrLinux = isArchPresentForMacOrLinux ;
2948+ function findAssetForWindows ( releases ) {
2949+ return releases . files . find ( ( item ) => utils_1 . WINDOWS_ARCHS . includes ( item . arch ) &&
2950+ utils_1 . WINDOWS_PLATFORMS . includes ( item . platform ) ) ;
2951+ }
2952+ exports . findAssetForWindows = findAssetForWindows ;
2953+ function findAssetForMacOrLinux ( releases , architecture , platform ) {
2954+ return releases . files . find ( ( item ) => item . arch === architecture && item . platform === platform ) ;
2955+ }
2956+ exports . findAssetForMacOrLinux = findAssetForMacOrLinux ;
29292957
29302958
29312959/***/ } ) ,
0 commit comments