mirror of
				https://gitea.com/actions/setup-python.git
				synced 2025-10-31 07:47:08 +00:00 
			
		
		
		
	Compare commits
	
		
			2 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 152ba7c4dd | ||
|   | da8703fb23 | 
							
								
								
									
										11
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										11
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							| @@ -6417,7 +6417,7 @@ function binDir(installDir) { | ||||
| // For example, PyPy 7.0 contains Python 2.7, 3.5, and 3.6-alpha. | ||||
| // We only care about the Python version, so we don't use the PyPy version for the tool cache. | ||||
| function usePyPy(majorVersion, architecture) { | ||||
|     const findPyPy = tc.find.bind(undefined, 'PyPy', majorVersion.toString()); | ||||
|     const findPyPy = tc.find.bind(undefined, 'PyPy', majorVersion); | ||||
|     let installDir = findPyPy(architecture); | ||||
|     if (!installDir && IS_WINDOWS) { | ||||
|         // PyPy only precompiles binaries for x86, but the architecture parameter defaults to x64. | ||||
| @@ -6437,6 +6437,10 @@ function usePyPy(majorVersion, architecture) { | ||||
|     core.exportVariable('pythonLocation', pythonLocation); | ||||
|     core.addPath(installDir); | ||||
|     core.addPath(_binDir); | ||||
|     // Starting from PyPy 7.3.1, the folder that is used for pip and anything that pip installs should be "Scripts" on Windows. | ||||
|     if (IS_WINDOWS) { | ||||
|         core.addPath(path.join(installDir, 'Scripts')); | ||||
|     } | ||||
|     const impl = 'pypy' + majorVersion.toString(); | ||||
|     core.setOutput('python-version', impl); | ||||
|     return { impl: impl, version: versionFromPath(installDir) }; | ||||
| @@ -6513,9 +6517,10 @@ function findPythonVersion(version, architecture) { | ||||
|     return __awaiter(this, void 0, void 0, function* () { | ||||
|         switch (version.toUpperCase()) { | ||||
|             case 'PYPY2': | ||||
|                 return usePyPy(2, architecture); | ||||
|                 return usePyPy('2', architecture); | ||||
|             case 'PYPY3': | ||||
|                 return usePyPy(3, architecture); | ||||
|                 // keep pypy3 pointing to 3.6 for backward compatibility | ||||
|                 return usePyPy('3.6', architecture); | ||||
|             default: | ||||
|                 return yield useCpythonVersion(version, architecture); | ||||
|         } | ||||
|   | ||||
| @@ -51,8 +51,11 @@ function binDir(installDir: string): string { | ||||
| // A particular version of PyPy may contain one or more versions of the Python interpreter. | ||||
| // For example, PyPy 7.0 contains Python 2.7, 3.5, and 3.6-alpha. | ||||
| // We only care about the Python version, so we don't use the PyPy version for the tool cache. | ||||
| function usePyPy(majorVersion: 2 | 3, architecture: string): InstalledVersion { | ||||
|   const findPyPy = tc.find.bind(undefined, 'PyPy', majorVersion.toString()); | ||||
| function usePyPy( | ||||
|   majorVersion: '2' | '3.6', | ||||
|   architecture: string | ||||
| ): InstalledVersion { | ||||
|   const findPyPy = tc.find.bind(undefined, 'PyPy', majorVersion); | ||||
|   let installDir: string | null = findPyPy(architecture); | ||||
|  | ||||
|   if (!installDir && IS_WINDOWS) { | ||||
| @@ -77,6 +80,10 @@ function usePyPy(majorVersion: 2 | 3, architecture: string): InstalledVersion { | ||||
|  | ||||
|   core.addPath(installDir); | ||||
|   core.addPath(_binDir); | ||||
|   // Starting from PyPy 7.3.1, the folder that is used for pip and anything that pip installs should be "Scripts" on Windows. | ||||
|   if (IS_WINDOWS) { | ||||
|     core.addPath(path.join(installDir, 'Scripts')); | ||||
|   } | ||||
|  | ||||
|   const impl = 'pypy' + majorVersion.toString(); | ||||
|   core.setOutput('python-version', impl); | ||||
| @@ -186,9 +193,10 @@ export async function findPythonVersion( | ||||
| ): Promise<InstalledVersion> { | ||||
|   switch (version.toUpperCase()) { | ||||
|     case 'PYPY2': | ||||
|       return usePyPy(2, architecture); | ||||
|       return usePyPy('2', architecture); | ||||
|     case 'PYPY3': | ||||
|       return usePyPy(3, architecture); | ||||
|       // keep pypy3 pointing to 3.6 for backward compatibility | ||||
|       return usePyPy('3.6', architecture); | ||||
|     default: | ||||
|       return await useCpythonVersion(version, architecture); | ||||
|   } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user