@@ -95,12 +95,25 @@ def copy_and_rename_wheels():
9595 # Create a additional copy of each build artifact with a ever green name with 'dev-latest' as
9696 # it's version.
9797 for pkg_name in os .listdir (utility .MSSQLCLI_DIST_DIRECTORY ):
98- first_dash = pkg_name .find ('-' )
99- second_dash = pkg_name .find ('-' , first_dash + 1 , len (pkg_name ))
100- pkg_daily_name = pkg_name .replace (pkg_name [first_dash + 1 :second_dash ], 'dev-latest' )
98+ file_name , file_extension = os .path .splitext (pkg_name )
99+
100+ if file_extension == '.gz' :
101+ file_extension = '.tar.gz'
102+ # rename sdist to make underscore consistent with wheel
103+ file_name = file_name .replace ('mssql-cli' , 'mssql_cli' ).replace ('.tar' , '' )
104+ end_index_to_replace = len (file_name )
105+
106+ first_dash = file_name .find ('-' )
107+
108+ if file_extension == '.whl' :
109+ end_index_to_replace = file_name .find ('-' , first_dash + 1 , len (file_name ))
110+
111+ pkg_daily_name = file_name .replace (file_name [first_dash + 1 :end_index_to_replace ],
112+ 'dev-latest' )
101113
102114 original_path = os .path .join (utility .MSSQLCLI_DIST_DIRECTORY , pkg_name )
103- updated_path = os .path .join (utility .MSSQLCLI_DIST_DIRECTORY , pkg_daily_name )
115+ updated_path = os .path .join (utility .MSSQLCLI_DIST_DIRECTORY ,
116+ pkg_daily_name + file_extension )
104117 copyfile (original_path , updated_path )
105118
106119
0 commit comments