@@ -279,18 +279,26 @@ def run_live_test():
279279 my_print ('live test run done, do not find failure !!!' )
280280
281281
282- def edit_useless_file ( ):
283- file = 'version.py' if TRACK == '1' else '_version.py'
284- path = f' { os . getcwd () } /sdk/ { SDK_FOLDER } /azure-mgmt- { SERVICE_NAME } /azure/mgmt/ { SERVICE_NAME } '
285- for folder in os . listdir ( path ) :
286- if os . path . isdir ( f' { path } / { folder } ' ) and os . path . exists ( f'{ path } /{ folder } / { file } ' ):
287- with open (f' { path } / { folder } / { file } ' , 'r' ) as file_in :
282+ def edit_recursion ( path , file ):
283+ all_folder = os . listdir ( path )
284+ for folder in all_folder :
285+ if file == folder :
286+ tmp_file = f'{ path } /{ file } '
287+ with open (tmp_file , 'r' ) as file_in :
288288 list_in = file_in .readlines ()
289289 for i in range (0 , len (list_in )):
290290 if list_in [i ].find ('VERSION' ) > - 1 :
291291 list_in [i ] = f'VERSION = "{ VERSION_NEW } "\n '
292- with open (f' { path } / { folder } / { file } ' , 'w' ) as file_out :
292+ with open (tmp_file , 'w' ) as file_out :
293293 file_out .writelines (list_in )
294+ elif os .path .isdir (f'{ path } /{ folder } ' ):
295+ edit_recursion (f'{ path } /{ folder } ' , file )
296+
297+
298+ def edit_useless_file ():
299+ file = 'version.py' if TRACK == '1' else '_version.py'
300+ path = f'{ os .getcwd ()} /sdk/{ SDK_FOLDER } /azure-mgmt-{ SERVICE_NAME } '
301+ edit_recursion (path , file )
294302
295303
296304def commit_test ():
0 commit comments