File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -98,9 +98,17 @@ export async function setVenvForGlobal(envPath: string | undefined): Promise<voi
9898 await state . set ( VENV_GLOBAL_KEY , envPath ) ;
9999}
100100
101- export async function getPythonInfo ( env : NativeEnvInfo ) : Promise < PythonEnvironmentInfo > {
101+ function getName ( binPath : string ) : string {
102+ const dir1 = path . dirname ( binPath ) ;
103+ if ( dir1 . endsWith ( 'bin' ) || dir1 . endsWith ( 'Scripts' ) || dir1 . endsWith ( 'scripts' ) ) {
104+ return path . basename ( path . dirname ( dir1 ) ) ;
105+ }
106+ return path . basename ( dir1 ) ;
107+ }
108+
109+ async function getPythonInfo ( env : NativeEnvInfo ) : Promise < PythonEnvironmentInfo > {
102110 if ( env . executable && env . version && env . prefix ) {
103- const venvName = env . name ;
111+ const venvName = env . name ?? getName ( env . executable ) ;
104112 const sv = shortVersion ( env . version ) ;
105113 const name = `${ venvName } (${ sv } )` ;
106114
You can’t perform that action at this time.
0 commit comments