Skip to content

Commit

Permalink
do not add pkg wheel entry to the index html file if it already exists (
Browse files Browse the repository at this point in the history
microsoft#9004)

* do not add pkg wheel entry to the index html file if it already exists
  • Loading branch information
liqunfu authored Sep 9, 2021
1 parent e357022 commit 6412c6a
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tools/ci_build/upload_python_package_to_azure_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import os
import argparse
import warnings
from azure.storage.blob import BlockBlobService, ContentSettings


Expand Down Expand Up @@ -44,12 +45,15 @@ def upload_whl(python_wheel_path, account_name, account_key, container_name):
lines = f.read().splitlines()

new_line = '<a href="{blobname}">{blobname}</a><br>'.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(
Expand Down

0 comments on commit 6412c6a

Please sign in to comment.