@@ -328,29 +328,42 @@ def _ask_user_confirmation(user_message: str) -> bool:
328
328
329
329
330
330
def _upgrade_daqmx_user_confirmation (
331
- latest_version : str ,
332
331
installed_version : str ,
333
- download_url : str ,
332
+ latest_version : str ,
334
333
release : str ,
335
334
) -> bool :
336
335
"""
337
336
Confirm with the user and return the user response.
338
337
339
338
"""
340
339
_logger .debug ("Entering _upgrade_daqmx_user_confirmation" )
341
- latest_parts : Tuple [int , ...] = _parse_version (latest_version )
342
340
installed_parts : Tuple [int , ...] = _parse_version (installed_version )
341
+ latest_parts : Tuple [int , ...] = _parse_version (latest_version )
343
342
if installed_parts >= latest_parts :
344
343
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.)"
346
345
)
347
346
return False
348
347
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?"
350
349
)
351
350
return is_upgrade
352
351
353
352
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
+
354
367
def _is_distribution_supported () -> None :
355
368
"""
356
369
Raises an exception if the linux distribution and its version are not supported.
@@ -401,18 +414,23 @@ def _install_daqmx_driver():
401
414
)
402
415
403
416
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 )
405
418
406
419
if not download_url :
407
420
raise click .ClickException (f"Failed to fetch the download url." )
408
- if not release :
421
+ if not release or not latest_version :
409
422
raise click .ClickException (f"Failed to fetch the release version string." )
410
423
else :
411
- if installed_version and latest_version :
424
+ if installed_version :
412
425
user_response = _upgrade_daqmx_user_confirmation (
413
- latest_version , installed_version , download_url , release
426
+ installed_version , latest_version , release
427
+ )
428
+ else :
429
+ user_response = _fresh_install_daqmx_user_confirmation (
430
+ latest_version , release
414
431
)
415
- if installed_version is None or (installed_version and user_response ):
432
+
433
+ if user_response :
416
434
if platform == "Linux" :
417
435
_install_daqmx_driver_linux_core (download_url , release )
418
436
else :
0 commit comments