33import json
44import requests
55import time
6- import subprocess
76from typing import List , Dict , Any
87# Removed custom zfill import as Python strings have a built-in zfill method
98
@@ -263,38 +262,6 @@ def get_latest_version(data: List[Dict[str, Any]]) -> Dict[str, Any]:
263262 sorted_data = sorted (numerical_only , key = lambda x : list (map (int , re .findall (r'\d+' , x ["version" ]))))
264263 return sorted_data [- 1 ] if sorted_data else {"version" : None , "files" : []}
265264
266- def extract_daemon_version (binary_path : str ) -> str :
267- """Run the binary with --version and extract the daemon version using regex."""
268- try :
269- result = subprocess .run ([binary_path , "--version" ], capture_output = True , text = True , check = True )
270- version_output = result .stdout .strip ()
271- match = re .search (r'version\s+(\d+\.\d+\.\d+)' , version_output , re .IGNORECASE )
272- if match :
273- return match .group (1 )
274- else :
275- print (f"No version found in output: { version_output } " )
276- return "unknown"
277- except subprocess .CalledProcessError as e :
278- print (f"Error running binary { binary_path } : { e } " )
279- return "error"
280-
281- def update_latest_export_with_daemon ():
282- """Update the latest export list with daemon versions."""
283- try :
284- with open (LE_VERSIONS , "r" ) as file :
285- latest_export = json .load (file )
286-
287- for entry in latest_export .get ("files" , []):
288- binary_path = os .path .join (CACHE_EXPORT_DIR , entry ["file_name" ])
289- daemon_version = extract_daemon_version (binary_path )
290- entry ["daemon_version" ] = daemon_version
291-
292- with open (LE_VERSIONS , "w" ) as file :
293- json .dump (latest_export , file , indent = 4 )
294-
295- print ("Updated latest export list with daemon versions." )
296- except Exception as e :
297- print (f"Failed to update daemon versions: { e } " )
298265
299266# development time code - create directories and initialize files
300267try :
@@ -425,16 +392,4 @@ def update_latest_export_with_daemon():
425392
426393except Exception as e :
427394 print (f"Error building final data: { e } " )
428- exit (1 )
429-
430- if __name__ == "__main__" :
431- import argparse
432-
433- parser = argparse .ArgumentParser ()
434- parser .add_argument ("--extract-daemon-versions" , action = "store_true" , help = "Extract daemon versions for the latest export list." )
435- args = parser .parse_args ()
436-
437- if args .extract_daemon_versions :
438- update_latest_export_with_daemon ()
439- else :
440- pass
395+ exit (1 )
0 commit comments