From 6412c6a36209d4a939dced829e2f76b5179254e3 Mon Sep 17 00:00:00 2001 From: liqun Fu Date: Thu, 9 Sep 2021 16:20:19 -0700 Subject: [PATCH] do not add pkg wheel entry to the index html file if it already exists (#9004) * do not add pkg wheel entry to the index html file if it already exists --- .../upload_python_package_to_azure_storage.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tools/ci_build/upload_python_package_to_azure_storage.py b/tools/ci_build/upload_python_package_to_azure_storage.py index 473fcc51ad81b..da7e4a8ea5e48 100755 --- a/tools/ci_build/upload_python_package_to_azure_storage.py +++ b/tools/ci_build/upload_python_package_to_azure_storage.py @@ -4,6 +4,7 @@ import os import argparse +import warnings from azure.storage.blob import BlockBlobService, ContentSettings @@ -44,12 +45,15 @@ def upload_whl(python_wheel_path, account_name, account_key, container_name): lines = f.read().splitlines() new_line = '{blobname}
'.format(blobname=blob_name_plus_replaced) - lines.append(new_line) - lines.sort() + if new_line not in lines: + lines.append(new_line) + lines.sort() - with open(download_path_to_html, 'w') as f: - for item in lines: - f.write("%s\n" % item) + with open(download_path_to_html, 'w') as f: + for item in lines: + f.write("%s\n" % item) + else: + warnings.warn("'{}' exists in {}. The html file is not updated.".format(new_line, download_path_to_html)) content_settings = ContentSettings(content_type='text/html') block_blob_service.create_blob_from_path(