@@ -417,7 +417,7 @@ def compress_directory_7z(base_output_dir, entry_name, arch=None):
417417
418418 # Execute the command
419419 try :
420- subprocess .run (command , check = True )
420+ subprocess .run (command , check = True , capture_output = True )
421421 print (f"Archive created successfully: { archive_name } " )
422422 return archive_name
423423 except subprocess .CalledProcessError as e :
@@ -561,8 +561,9 @@ async def upload_release_asset(session, token, repo, release_id, asset_path, ass
561561 if delete_existing :
562562 with open (asset_path , 'rb' ) as file :
563563 print (f'Uploading new asset: { asset_name } ' )
564- response = requests .post (url , headers = headers , data = file )
565- response .raise_for_status ()
564+ async with session .post (url , headers = headers , data = file ) as response :
565+ response .raise_for_status ()
566+ result = await response .json ()
566567 print (f'\033 [92mUploaded asset: { os .path .basename (asset_path )} to release ID: { release_id } \033 [0m' )
567568 else :
568569 asset_exists = False
@@ -579,7 +580,7 @@ async def upload_release_asset(session, token, repo, release_id, asset_path, ass
579580 print (f'\033 [92mUploaded asset: { os .path .basename (asset_path )} to release ID: { release_id } \033 [0m' )
580581
581582 # Remove the asset from local drive to avoid reaching the memory limit
582- if os .path .exists (asset_path ):
583+ if os .path .exists (asset_path ) and '.7z' in asset_path and 'database' not in asset_path :
583584 print (f'\033 [93mRemoved asset { os .path .basename (asset_path )} locally on running machine\033 [0m' )
584585 os .remove (asset_path )
585586 return result
@@ -593,7 +594,10 @@ async def package_asset(source_dir, output_dir, arch, entry_name, token, repo, t
593594 package_to_mcu_xlsx = []
594595 package_to_mcu_json_full = []
595596 package_to_mcu_xlsx_full = []
597+ current_package_num = 1
596598 for cmake_file , data in file_paths .items ():
599+ print (f'\033 [96m[{ current_package_num } /{ len (file_paths )} ] Processing { cmake_file } \033 [0m' )
600+ current_package_num += 1
597601 base_output_dir = os .path .join (output_dir , f"{ arch .lower ()} _{ entry_name .lower ()} _{ cmake_file } " ) # Subdirectory for this .cmake file
598602 # Copy the .cmake file into the package directory
599603 copy_cmake_files (data ['cmake_file_path' ], source_dir , base_output_dir , data ['regex' ])
@@ -648,12 +652,13 @@ async def package_asset(source_dir, output_dir, arch, entry_name, token, repo, t
648652 shutil .rmtree (base_output_dir )
649653 # Upload archive
650654 upload_result = ""
651- async with aiohttp .ClientSession () as session :
652- upload_tasks = [upload_release_asset (session , token , repo , release_id , archive_path , assets )]
653- results = await asyncio .gather (* upload_tasks , return_exceptions = True )
654- for result in results :
655- upload_result = result
656- print ("All uploads completed." )
655+ # async with aiohttp.ClientSession() as session:
656+ # upload_tasks = [upload_release_asset(session, token, repo, release_id, archive_path, assets)]
657+ # results = await asyncio.gather(*upload_tasks, return_exceptions=True)
658+ # for result in results:
659+ # upload_result = result
660+ # TODO Uncomment for debugging purposes
661+ # print("All uploads completed.")
657662
658663 # Determine the version based on the hash
659664 version = get_version_based_on_hash (archiveName , tag_name .replace ("v" , "" ), archiveHash , current_metadata )
0 commit comments