@@ -32,8 +32,9 @@ class PythonInfo: # noqa: PLR0904
32
32
"""Contains information for a Python interpreter."""
33
33
34
34
def __init__ (self ) -> None : # noqa: PLR0915
35
- def abs_path (v ):
36
- return None if v is None else os .path .abspath (v ) # unroll relative elements from path (e.g. ..)
35
+ def real_path (v ):
36
+ # unroll relative elements from path (e.g. ..) and ensure symbolic links are resolved
37
+ return None if v is None else os .path .realpath (v )
37
38
38
39
# qualifies the python
39
40
self .platform = sys .platform
@@ -53,16 +54,16 @@ def abs_path(v):
53
54
self .os = os .name
54
55
55
56
# information about the prefix - determines python home
56
- self .prefix = abs_path (getattr (sys , "prefix" , None )) # prefix we think
57
- self .base_prefix = abs_path (getattr (sys , "base_prefix" , None )) # venv
58
- self .real_prefix = abs_path (getattr (sys , "real_prefix" , None )) # old virtualenv
57
+ self .prefix = real_path (getattr (sys , "prefix" , None )) # prefix we think
58
+ self .base_prefix = real_path (getattr (sys , "base_prefix" , None )) # venv
59
+ self .real_prefix = real_path (getattr (sys , "real_prefix" , None )) # old virtualenv
59
60
60
61
# information about the exec prefix - dynamic stdlib modules
61
- self .base_exec_prefix = abs_path (getattr (sys , "base_exec_prefix" , None ))
62
- self .exec_prefix = abs_path (getattr (sys , "exec_prefix" , None ))
62
+ self .base_exec_prefix = real_path (getattr (sys , "base_exec_prefix" , None ))
63
+ self .exec_prefix = real_path (getattr (sys , "exec_prefix" , None ))
63
64
64
- self .executable = abs_path (sys .executable ) # the executable we were invoked via
65
- self .original_executable = abs_path (self .executable ) # the executable as known by the interpreter
65
+ self .executable = real_path (sys .executable ) # the executable we were invoked via
66
+ self .original_executable = real_path (self .executable ) # the executable as known by the interpreter
66
67
self .system_executable = self ._fast_get_system_executable () # the executable we are based of (if available)
67
68
68
69
try :
0 commit comments