@@ -1108,10 +1108,6 @@ function findPyPyVersion(versionSpec, architecture) {
1108
1108
let resolvedPythonVersion = '' ;
1109
1109
let installDir ;
1110
1110
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
- }
1115
1111
( { installDir, resolvedPythonVersion, resolvedPyPyVersion } = findPyPyToolCache ( pypyVersionSpec . pythonVersion , pypyVersionSpec . pypyVersion , architecture ) ) ;
1116
1112
if ( ! installDir ) {
1117
1113
( {
@@ -1133,7 +1129,9 @@ exports.findPyPyVersion = findPyPyVersion;
1133
1129
function findPyPyToolCache ( pythonVersion , pypyVersion , architecture ) {
1134
1130
let resolvedPyPyVersion = '' ;
1135
1131
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 ) ;
1137
1135
if ( installDir ) {
1138
1136
// 'tc.find' finds tool based on Python version but we also need to check
1139
1137
// whether PyPy version satisfies requested version.
@@ -1177,6 +1175,12 @@ function parsePyPyVersion(versionSpec) {
1177
1175
} ;
1178
1176
}
1179
1177
exports . 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 ;
1180
1184
1181
1185
1182
1186
/***/ } ) ,
@@ -2327,6 +2331,8 @@ const path = __importStar(__webpack_require__(622));
2327
2331
const semver = __importStar ( __webpack_require__ ( 876 ) ) ;
2328
2332
exports . IS_WINDOWS = process . platform === 'win32' ;
2329
2333
exports . IS_LINUX = process . platform === 'linux' ;
2334
+ exports . WINDOWS_ARCHS = [ 'x86' , 'x64' ] ;
2335
+ exports . WINDOWS_PLATFORMS = [ 'win32' , 'win64' ] ;
2330
2336
const PYPY_VERSION_FILE = 'PYPY_VERSION' ;
2331
2337
/** create Symlinks for downloaded PyPy
2332
2338
* It should be executed only for downloaded versions in runtime, because
@@ -2893,7 +2899,9 @@ function findRelease(releases, pythonVersion, pypyVersion, architecture) {
2893
2899
const isPyPyVersionSatisfied = isPyPyNightly ||
2894
2900
semver . satisfies ( pypyVersionToSemantic ( item . pypy_version ) , pypyVersion ) ;
2895
2901
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 ) ) ;
2897
2905
return isPythonVersionSatisfied && isPyPyVersionSatisfied && isArchPresent ;
2898
2906
} ) ;
2899
2907
if ( filterReleases . length === 0 ) {
@@ -2904,7 +2912,9 @@ function findRelease(releases, pythonVersion, pypyVersion, architecture) {
2904
2912
semver . compare ( semver . coerce ( current . python_version ) , semver . coerce ( previous . python_version ) ) ) ;
2905
2913
} ) ;
2906
2914
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 ) ;
2908
2918
return {
2909
2919
foundAsset,
2910
2920
resolvedPythonVersion : foundRelease . python_version ,
@@ -2926,6 +2936,24 @@ function pypyVersionToSemantic(versionSpec) {
2926
2936
return versionSpec . replace ( prereleaseVersion , '$1-$2.$3' ) ;
2927
2937
}
2928
2938
exports . 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 ;
2929
2957
2930
2958
2931
2959
/***/ } ) ,
0 commit comments