forked from ni/nidaqmx-python
-
Notifications
You must be signed in to change notification settings - Fork 0
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
pbhogara
wants to merge
30
commits into
master
Choose a base branch
from
users/pbhogara/daqmx-installation-linux-support
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50c6dbe
to
679b7ac
Compare
…nto users/pbhogara/daqmx-installation-linux-support
…nto users/pbhogara/daqmx-installation-linux-support
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this Pull Request accomplish?
Adds support for installing ni-daqmx driver on Linux OS.
Command to run:
poetry run nidaqmx installdriver
Steps:
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.
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
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:
dpkg -l ni-daqmx
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.
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.
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.