Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate installation of daqmx driver on Linux #1

Draft
wants to merge 30 commits into
base: master
Choose a base branch
from

Conversation

pbhogara
Copy link
Owner

@pbhogara pbhogara commented Apr 8, 2024

What does this Pull Request accomplish?

Adds support for installing ni-daqmx driver on Linux OS.
Command to run: poetry run nidaqmx installdriver

Steps:

  1. Get the OS info. If it is Linux, call _install_daqmx_linux_driver(), if windows, call _install_daqmx_windows_driver()
    sys.platform is used to detect if the OS is Linux or Windows.

  2. Check the type of Linux distrubtion and the version of the distribution.
    distro package is used for this purpose. distro.id() returns either ubuntu, opensuse or redhat. distro.version() returns the distribution version (20.4 - Ubuntu, 8.8 - rhel). distro has been added to poetry.lock file by running
    poetry add distro
    poetry lock

  3. Check if ni-daqmx package is already installed, if yes, get the version installed. We do this by running the following commands, and using regular expressions to extract the version:

    • Ubuntu: dpkg -l ni-daqmx
    • OpenSuse and RHEL: rpm -q ni-daqmx
      Compare the version installed with the version mentioned in metadata.json. If the latest version is already installed, inform the user, otherwise ask if they want to upgrade. If ni-daqmx is not installed, proceed with the installation.
  4. Download NI Linux Device Drivers using the url mentioned in the metadata.json file into a temporary zip file. Extract the zip file contents using the zipfile module to a temporary directory.

  5. Run commands from the official documentation. User will be prompted to enter the sudo password as the commands need admin privileges.

Why should this Pull Request be merged?

Currently, we only support daqmx driver installation for Windows OS which was implemented as part of this PR. This PR extends that feature for Linux.

What testing has been done?

Created VMs for all the supported distributions and distribution-versions and tested the module on all of them.
"ubuntu 20.04"
"ubuntu 22.04"
"rhel 8"
"rhel 9"
"opensuse 15.4"
"opensuse 15.5"

Video clip of how installation would look on ubuntu (Will be accessible within NI domain only):
ubuntu 22.04 installation

Tested on linuxmint which is an unsupported distribution to get the following error.
Error: Unsupported distribution 'linuxmint'

Tested on Windows to ensure that the existing implementation for windows is unaffected.

Ran poetry run pytest. No test fails.

image

@pbhogara pbhogara force-pushed the users/pbhogara/daqmx-installation-linux-support branch from 50c6dbe to 679b7ac Compare April 17, 2024 03:30
@pbhogara pbhogara changed the title Users/pbhogara/daqmx installation linux support Automate installation if daqmx driver on Linux May 5, 2024
@pbhogara pbhogara changed the title Automate installation if daqmx driver on Linux Automate installation of daqmx driver on Linux May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant