You've already forked setup-python
							
							
				mirror of
				https://github.com/actions/setup-python.git
				synced 2025-10-31 07:06:25 +07:00 
			
		
		
		
	feature: add a python-path output
				
					
				
			Expose a `python-path` output containing the chosen Python executable path.
This commit is contained in:
		| @ -48,12 +48,18 @@ export async function findPyPyVersion( | ||||
|  | ||||
|   const pipDir = IS_WINDOWS ? 'Scripts' : 'bin'; | ||||
|   const _binDir = path.join(installDir, pipDir); | ||||
|   const binaryExtension = IS_WINDOWS ? '.exe' : ''; | ||||
|   const pythonPath = path.join( | ||||
|     IS_WINDOWS ? installDir : _binDir, | ||||
|     `python${binaryExtension}` | ||||
|   ); | ||||
|   const pythonLocation = pypyInstall.getPyPyBinaryPath(installDir); | ||||
|   core.exportVariable('pythonLocation', pythonLocation); | ||||
|   core.exportVariable('PKG_CONFIG_PATH', pythonLocation + '/lib/pkgconfig'); | ||||
|   core.addPath(pythonLocation); | ||||
|   core.addPath(_binDir); | ||||
|   core.setOutput('python-version', 'pypy' + resolvedPyPyVersion.trim()); | ||||
|   core.setOutput('python-path', pythonPath); | ||||
|  | ||||
|   return {resolvedPyPyVersion, resolvedPythonVersion}; | ||||
| } | ||||
|  | ||||
| @ -83,8 +83,14 @@ export async function useCpythonVersion( | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   const _binDir = binDir(installDir); | ||||
|   const binaryExtension = IS_WINDOWS ? '.exe' : ''; | ||||
|   const pythonPath = path.join( | ||||
|     IS_WINDOWS ? installDir : _binDir, | ||||
|     `python${binaryExtension}` | ||||
|   ); | ||||
|   core.addPath(installDir); | ||||
|   core.addPath(binDir(installDir)); | ||||
|   core.addPath(_binDir); | ||||
|  | ||||
|   if (IS_WINDOWS) { | ||||
|     // Add --user directory | ||||
| @ -106,6 +112,7 @@ export async function useCpythonVersion( | ||||
|  | ||||
|   const installed = versionFromPath(installDir); | ||||
|   core.setOutput('python-version', installed); | ||||
|   core.setOutput('python-path', pythonPath); | ||||
|  | ||||
|   return {impl: 'CPython', version: installed}; | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 mayeut
					mayeut