@@ -66,7 +66,11 @@ def get_python_info(python=sys.executable):
6666 )
6767 except subprocess .CalledProcessError :
6868 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
7074
7175
7276def inspect_python_install (python = sys .executable ):
@@ -169,12 +173,12 @@ def _get_raw_info():
169173 return {
170174 'executable' : sys .executable ,
171175 'version_str' : sys .version ,
172- 'version_info' : tuple ( sys .version_info ) ,
176+ 'version_info' : sys .version_info ,
173177 'hexversion' : sys .hexversion ,
174178 'api_version' : sys .api_version ,
175179 'magic_number' : MAGIC_NUMBER .hex (),
176180 'implementation_name' : sys .implementation .name .lower (),
177- 'implementation_version' : tuple ( sys .implementation .version ) ,
181+ 'implementation_version' : sys .implementation .version ,
178182 'platform' : sys .platform ,
179183 'prefix' : sys .prefix ,
180184 'exec_prefix' : sys .exec_prefix ,
@@ -191,7 +195,8 @@ def _get_raw_info():
191195
192196if __name__ == '__main__' :
193197 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 )
196201 json .dump (info , sys .stdout , indent = 4 )
197202 print ()
0 commit comments