@@ -328,29 +328,42 @@ def _ask_user_confirmation(user_message: str) -> bool:
328328
329329
330330def _upgrade_daqmx_user_confirmation (
331- latest_version : str ,
332331 installed_version : str ,
333- download_url : str ,
332+ latest_version : str ,
334333 release : str ,
335334) -> bool :
336335 """
337336 Confirm with the user and return the user response.
338337
339338 """
340339 _logger .debug ("Entering _upgrade_daqmx_user_confirmation" )
341- latest_parts : Tuple [ int , ...] = _parse_version (latest_version )
342- installed_parts : Tuple [ int , ...] = _parse_version (installed_version )
340+ installed_parts = _parse_version (installed_version )
341+ latest_parts = _parse_version (latest_version )
343342 if installed_parts >= latest_parts :
344343 print (
345- f"Installed NI-DAQmx version ({ installed_version } ) is up to date. (Expected { latest_version } or newer.)"
344+ f"Installed NI-DAQmx version ({ installed_version } ) is up to date. (Expected { latest_version } ( { release } ) or newer.)"
346345 )
347346 return False
348347 is_upgrade = _ask_user_confirmation (
349- f"Installed NI-DAQmx version is { installed_version } . Latest version available is { latest_version } . Do you want to upgrade?"
348+ f"Installed NI-DAQmx version is { installed_version } . Latest version available is { latest_version } ( { release } ) . Do you want to upgrade?"
350349 )
351350 return is_upgrade
352351
353352
353+ def _fresh_install_daqmx_user_confirmation (
354+ latest_version : str ,
355+ release : str ,
356+ ) -> bool :
357+ """
358+ Confirm with the user and return the user response.
359+
360+ """
361+ _logger .debug ("Entering _fresh_install_daqmx_user_confirmation" )
362+ return _ask_user_confirmation (
363+ f"Latest NI-DAQmx version available is { latest_version } ({ release } ). Do you want to install?"
364+ )
365+
366+
354367def _is_distribution_supported () -> None :
355368 """
356369 Raises an exception if the linux distribution and its version are not supported.
@@ -401,18 +414,23 @@ def _install_daqmx_driver():
401414 )
402415
403416 installed_version = _get_daqmx_installed_version ()
404- download_url , latest_version , release , supported_os = _get_driver_details (platform )
417+ download_url , latest_version , release , _ = _get_driver_details (platform )
405418
406419 if not download_url :
407420 raise click .ClickException (f"Failed to fetch the download url." )
408- if not release :
421+ if not release or not latest_version :
409422 raise click .ClickException (f"Failed to fetch the release version string." )
410423 else :
411- if installed_version and latest_version :
424+ if installed_version :
412425 user_response = _upgrade_daqmx_user_confirmation (
413- latest_version , installed_version , download_url , release
426+ installed_version , latest_version , release
414427 )
415- if installed_version is None or (installed_version and user_response ):
428+ else :
429+ user_response = _fresh_install_daqmx_user_confirmation (
430+ latest_version , release
431+ )
432+
433+ if user_response :
416434 if platform == "Linux" :
417435 _install_daqmx_driver_linux_core (download_url , release )
418436 else :
0 commit comments