@@ -168,6 +168,26 @@ async function verifyFileIntegrity(filePath, expectedSHA) {
168168 }
169169}
170170
171+ /**
172+ * Check if Python version is compatible
173+ * @param {string } pythonVersion - Python version string (e.g., "3.13.1")
174+ * @param {boolean } forInstallation - If true, only allows 3.13.x; if false, allows 3.10-3.13
175+ * @returns {boolean } True if version is compatible
176+ */
177+ function isPythonVersionCompatible ( pythonVersion , forInstallation = false ) {
178+ const versionParts = pythonVersion . split ( '.' ) ;
179+ const major = parseInt ( versionParts [ 0 ] , 10 ) ;
180+ const minor = parseInt ( versionParts [ 1 ] , 10 ) ;
181+
182+ if ( major !== 3 ) return false ;
183+
184+ if ( forInstallation ) {
185+ return minor === 13 ; // Only 3.13.x for installation
186+ } else {
187+ return minor >= 10 && minor <= 13 ; // 3.10-3.13 for finding existing
188+ }
189+ }
190+
171191/**
172192 * Search for existing Python executable in system PATH with version validation
173193 * Accepts Python versions 3.10 through 3.13. Stops at first valid installation found.
@@ -226,8 +246,7 @@ async function isValidPythonVersion(executable) {
226246 const versionMatch = output . match ( / P y t h o n ( \d + \. \d + \. \d + ) / ) ;
227247 if ( ! versionMatch ) return false ;
228248
229- const version = versionMatch [ 1 ] ;
230- return semver . gte ( version , '3.10.0' ) && semver . lt ( version , '3.14.0' ) ;
249+ return isPythonVersionCompatible ( versionMatch [ 1 ] , false ) ; // Allow 3.10-3.13 for finding
231250 } catch {
232251 return false ;
233252 }
@@ -405,20 +424,9 @@ async function tryGetRegistryFromRelease(releaseTag, systype) {
405424 * @returns {object|null } Best asset or null if none found
406425 */
407426function selectBestAsset ( releaseData , systype ) {
408- // Filter compatible assets with multiple naming pattern support
427+ // Filter compatible assets - only Python 3.13.x for installation
409428 const compatibleAssets = releaseData . assets . filter ( asset => {
410- const isCompatible = isAssetCompatible ( asset . name , systype ) || isAssetCompatibleFallback ( asset . name , systype ) ;
411- if ( ! isCompatible ) return false ;
412-
413- const parsed = parseAssetName ( asset . name ) || parseAssetNameFallback ( asset . name ) ;
414- if ( ! parsed ) return false ;
415-
416- const versionParts = parsed . pythonVersion . split ( '.' ) ;
417- const major = parseInt ( versionParts [ 0 ] , 10 ) ;
418- const minor = parseInt ( versionParts [ 1 ] , 10 ) ;
419-
420- // Only Python 3.13.x allowed for installation
421- return major === 3 && minor === 13 ;
429+ return isAssetCompatible ( asset . name , systype ) || isAssetCompatibleFallback ( asset . name , systype ) ;
422430 } ) ;
423431
424432 if ( compatibleAssets . length === 0 ) {
@@ -520,11 +528,8 @@ function isAssetCompatible(assetName, systype) {
520528 return false ;
521529 }
522530
523- // Quick Python version check for v3.13
524- const versionParts = parsed . pythonVersion . split ( '.' ) ;
525- const major = parseInt ( versionParts [ 0 ] , 10 ) ;
526- const minor = parseInt ( versionParts [ 1 ] , 10 ) ;
527- if ( major !== 3 || minor !== 13 ) {
531+ // Only Python 3.13.x for installation (centralized check)
532+ if ( ! isPythonVersionCompatible ( parsed . pythonVersion , true ) ) {
528533 return false ;
529534 }
530535
@@ -561,10 +566,8 @@ function isAssetCompatibleFallback(assetName, systype) {
561566 return false ;
562567 }
563568
564- const versionParts = parsed . pythonVersion . split ( '.' ) ;
565- const major = parseInt ( versionParts [ 0 ] , 10 ) ;
566- const minor = parseInt ( versionParts [ 1 ] , 10 ) ;
567- if ( major !== 3 || minor !== 13 ) {
569+ // Only Python 3.13.x for installation (centralized check)
570+ if ( ! isPythonVersionCompatible ( parsed . pythonVersion , true ) ) {
568571 return false ;
569572 }
570573
0 commit comments