@@ -66,7 +66,11 @@ def get_python_info(python=sys.executable):
66
66
)
67
67
except subprocess .CalledProcessError :
68
68
raise Exception (f'could not get info for { python } ' )
69
- return json .loads (text )
69
+ info = json .loads (text )
70
+ # We would use type(sys.version_info) if it allowed it.
71
+ info ['version_info' ] = tuple (info ['version_info' ])
72
+ info ['implementation_version' ] = tuple (info ['implementation_version' ])
73
+ return info
70
74
71
75
72
76
def inspect_python_install (python = sys .executable ):
@@ -169,12 +173,12 @@ def _get_raw_info():
169
173
return {
170
174
'executable' : sys .executable ,
171
175
'version_str' : sys .version ,
172
- 'version_info' : tuple ( sys .version_info ) ,
176
+ 'version_info' : sys .version_info ,
173
177
'hexversion' : sys .hexversion ,
174
178
'api_version' : sys .api_version ,
175
179
'magic_number' : MAGIC_NUMBER .hex (),
176
180
'implementation_name' : sys .implementation .name .lower (),
177
- 'implementation_version' : tuple ( sys .implementation .version ) ,
181
+ 'implementation_version' : sys .implementation .version ,
178
182
'platform' : sys .platform ,
179
183
'prefix' : sys .prefix ,
180
184
'exec_prefix' : sys .exec_prefix ,
@@ -191,7 +195,8 @@ def _get_raw_info():
191
195
192
196
if __name__ == '__main__' :
193
197
info = _get_raw_info ()
194
- (info ['_base_executable' ], info ['_is_dev' ], info ['_is_venv' ],
195
- ) = _inspect_python_install (** info )
198
+ if '--inspect' in sys .argv :
199
+ (info ['_base_executable' ], info ['_is_dev' ], info ['_is_venv' ],
200
+ ) = _inspect_python_install (** info )
196
201
json .dump (info , sys .stdout , indent = 4 )
197
202
print ()
0 commit comments