@@ -124,11 +124,17 @@ def extract_module_metadata_update_info_pre(mod_update_info, mod):
124124 if module_meta_update_match :
125125 mod_update_info ["meta_updated" ] = True
126126
127+ def check_extension_list ():
128+ cmd = ["az" , "extension" , "list" , "-o" , "table" ]
129+ print ("cmd: " , cmd )
130+ res = subprocess .run (cmd , stdout = subprocess .PIPE )
131+ print (res .stdout .decode ("utf8" ))
127132
128133def clean_mod_of_azdev (mod ):
129134 """
130135 be sure to get all the required info before removing mod in azdev
131136 """
137+ print ("removing azdev extensions: " , mod )
132138 cmd = ["azdev" , "extension" , "remove" , mod ]
133139 result = subprocess .run (cmd , stdout = subprocess .PIPE )
134140 if result .returncode :
@@ -138,19 +144,23 @@ def clean_mod_of_azdev(mod):
138144def install_mod_of_last_version (pkg_name , pre_release ):
139145 whl_file_url = pre_release ['downloadUrl' ]
140146 cmd = ["az" , "extension" , "add" , "-s" , whl_file_url , "-y" ]
147+ print ("cmd: " , cmd )
141148 result = subprocess .run (cmd , stdout = subprocess .PIPE )
142149 if result .returncode :
143150 raise Exception (f'Error when adding { pkg_name } from source { whl_file_url } ' )
151+ check_extension_list ()
144152
145153
146154def remove_mod_of_last_version (pkg_name ):
147- cmd = ['az' , 'extension' , 'remove' , '-n' , { pkg_name } ]
155+ cmd = ['az' , 'extension' , 'remove' , '-n' , pkg_name ]
148156 result = subprocess .run (cmd , stdout = subprocess .PIPE )
149157 if result .returncode :
150158 raise Exception (f'Error when removing { pkg_name } ' )
159+ check_extension_list ()
151160
152161def gen_metadata_from_whl (pkg_name , target_folder ):
153- cmd = ['azdev' , 'command-change' , 'meta-export' , {pkg_name }, '--include-whl-extensions' , '--meta-output-path' , target_folder ]
162+ cmd = ['azdev' , 'command-change' , 'meta-export' , pkg_name , '--include-whl-extensions' , '--meta-output-path' , target_folder , "--debug" ]
163+ print ("cmd: " , cmd )
154164 result = subprocess .run (cmd , stdout = subprocess .PIPE )
155165 if result .returncode :
156166 raise Exception (f'Error when generating metadata from whl for { pkg_name } ' )
@@ -236,11 +246,12 @@ def extract_module_version_info(mod_update_info, mod):
236246 pkg_name = get_mod_package_name (mod )
237247 pre_release = get_module_metadata_of_max_version (pkg_name )
238248 print (f"Get prerelease info for mod: { mod } as below:" )
239- print (json .dump (pre_release ))
249+ print (json .dumps (pre_release ))
240250 clean_mod_of_azdev (mod )
241251 print ("Start generating base metadata" )
242252 install_mod_of_last_version (pkg_name , pre_release )
243- gen_metadata_from_whl (pkg_name , cli_ext_path + "/" + base_meta_path )
253+ base_meta_folder = os .path .join (cli_ext_path , base_meta_path )
254+ gen_metadata_from_whl (pkg_name , base_meta_folder )
244255 remove_mod_of_last_version (pkg_name )
245256 print ("End generating base metadata" )
246257 base_meta_file = os .path .join (cli_ext_path , base_meta_path , "az_" + pkg_name + "_meta.json" )
@@ -470,4 +481,4 @@ def main():
470481
471482
472483if __name__ == '__main__' :
473- main ()
484+ main ()
0 commit comments