quarchpy 2.1.25__py2.py3-none-any.whl → 2.1.26__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- quarchpy/__pycache__/_version.cpython-311.pyc +0 -0
- quarchpy/_version.py +1 -1
- quarchpy/debug/SystemTest.py +2 -6
- quarchpy/debug/SystemTest.py.bak +200 -0
- quarchpy/debug/__pycache__/SystemTest.cpython-311.pyc +0 -0
- quarchpy/docs/CHANGES.rst +4 -0
- quarchpy/docs/_build/doctrees/CHANGES.doctree +0 -0
- quarchpy/docs/_build/doctrees/environment.pickle +0 -0
- quarchpy/docs/_build/doctrees/source/changelog.doctree +0 -0
- quarchpy/docs/_build/html/CHANGES.html +129 -123
- quarchpy/docs/_build/html/_sources/CHANGES.rst.txt +4 -0
- quarchpy/docs/_build/html/index.html +63 -62
- quarchpy/docs/_build/html/searchindex.js +1 -1
- quarchpy/docs/_build/html/source/changelog.html +192 -185
- {quarchpy-2.1.25.dist-info → quarchpy-2.1.26.dist-info}/METADATA +6 -2
- {quarchpy-2.1.25.dist-info → quarchpy-2.1.26.dist-info}/RECORD +18 -19
- {quarchpy-2.1.25.dist-info → quarchpy-2.1.26.dist-info}/WHEEL +1 -1
- quarchpy/connection_specific/__pycache__/connection_Telnet.cpython-311.pyc +0 -0
- quarchpy/fio/__pycache__/fioDiskFinder.cpython-311.pyc +0 -0
- {quarchpy-2.1.25.dist-info → quarchpy-2.1.26.dist-info}/top_level.txt +0 -0
Binary file
|
quarchpy/_version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "2.1.
|
1
|
+
__version__ = "2.1.26"
|
quarchpy/debug/SystemTest.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
from quarchpy import *
|
2
|
+
from quarchpy.device import *
|
3
3
|
try:
|
4
4
|
from importlib.metadata import distribution
|
5
5
|
except:
|
@@ -7,11 +7,7 @@ except:
|
|
7
7
|
from importlib_metadata import distribution
|
8
8
|
except Exception as e:
|
9
9
|
print("Failed to import distribution from importlib_metadata")
|
10
|
-
try:
|
11
10
|
|
12
|
-
from importlib_metadata import distribution
|
13
|
-
except:
|
14
|
-
print("here")
|
15
11
|
import os
|
16
12
|
import platform
|
17
13
|
import sys
|
@@ -0,0 +1,200 @@
|
|
1
|
+
from quarchpy import *
|
2
|
+
from quarchpy.device import *
|
3
|
+
try:
|
4
|
+
from importlib.metadata import distribution
|
5
|
+
except:
|
6
|
+
try:
|
7
|
+
from importlib_metadata import distribution
|
8
|
+
except Exception as e:
|
9
|
+
print("Failed to import distribution from importlib_metadata")
|
10
|
+
|
11
|
+
import os
|
12
|
+
import platform
|
13
|
+
import sys
|
14
|
+
import subprocess
|
15
|
+
from quarchpy._version import __version__
|
16
|
+
|
17
|
+
def test_communication():
|
18
|
+
print("")
|
19
|
+
print("DEVICE COMMUNICATION TEST")
|
20
|
+
print("-------------------------")
|
21
|
+
print("")
|
22
|
+
deviceList = scanDevices('all', favouriteOnly=False)
|
23
|
+
print("Devices visible:\r\n" + str(deviceList))
|
24
|
+
print("")
|
25
|
+
moduleStr = userSelectDevice(deviceList, nice=True, additionalOptions=["Rescan", "Quit", "All Conn Types"])
|
26
|
+
if moduleStr == "quit":
|
27
|
+
print("User selected quit")
|
28
|
+
return 0
|
29
|
+
print("Selected module is: " + moduleStr)
|
30
|
+
# Create a device using the module connection string
|
31
|
+
myDevice = getQuarchDevice(moduleStr)
|
32
|
+
QuarchSimpleIdentify(myDevice)
|
33
|
+
# Close the module before exiting the script
|
34
|
+
myDevice.closeConnection()
|
35
|
+
|
36
|
+
def test_system_info():
|
37
|
+
print("")
|
38
|
+
print("SYSTEM INFORMATION")
|
39
|
+
print("------------------")
|
40
|
+
print("OS Name: " + os.name)
|
41
|
+
print("Platform System: " + platform.system())
|
42
|
+
print("Platform: " + platform.platform())
|
43
|
+
|
44
|
+
if "nt" in os.name:
|
45
|
+
print("Platform Architecture: " + platform.architecture()[0])
|
46
|
+
else:
|
47
|
+
print(str(bytes(subprocess.check_output(['cat', '/etc/os-release'], stderr=subprocess.STDOUT)).decode()))
|
48
|
+
print("Platform Release: " + platform.release())
|
49
|
+
|
50
|
+
try:
|
51
|
+
print("Quarchpy Version: " + get_quarchpy_version())
|
52
|
+
except:
|
53
|
+
print("Unable to detect Quarchpy version")
|
54
|
+
try:
|
55
|
+
print("Quarchpy info Location: " + str(distribution("quarchpy")._path))
|
56
|
+
except Exception as e:
|
57
|
+
print(e)
|
58
|
+
print("Unable to detect Quarchpy location")
|
59
|
+
try:
|
60
|
+
print("Python Version: " + sys.version)
|
61
|
+
except:
|
62
|
+
print("Unable to detect Python version")
|
63
|
+
try:
|
64
|
+
print("QIS version number: " + get_QIS_version())
|
65
|
+
except:
|
66
|
+
print("Unable to detect QIS version")
|
67
|
+
try:
|
68
|
+
javaVersion = bytes(subprocess.check_output(['java', '-version'], stderr=subprocess.STDOUT)).decode()
|
69
|
+
print("Java Version: " + str(javaVersion))
|
70
|
+
except:
|
71
|
+
print("Unable to detect java version"
|
72
|
+
"If Java is not installed then QIS and QPS will NOT run")
|
73
|
+
try:
|
74
|
+
javaLocation = get_java_location()
|
75
|
+
print("Java Location: " + str(javaLocation))
|
76
|
+
except:
|
77
|
+
print("Unable to detect java location"
|
78
|
+
"If Java is not installed then QIS and QPS will NOT run")
|
79
|
+
|
80
|
+
# Scan for all quarch devices on the system
|
81
|
+
|
82
|
+
def QuarchSimpleIdentify(device1):
|
83
|
+
"""
|
84
|
+
Prints basic identification test data on the specified module, compatible with all Quarch devices
|
85
|
+
|
86
|
+
Parameters
|
87
|
+
----------
|
88
|
+
device1: quarchDevice
|
89
|
+
Open connection to a quarch device
|
90
|
+
|
91
|
+
"""
|
92
|
+
# Print the module name
|
93
|
+
print("MODULE IDENTIFY TEST")
|
94
|
+
print("--------------------")
|
95
|
+
print("")
|
96
|
+
print("Module Name: "),
|
97
|
+
print(device1.sendCommand("hello?"))
|
98
|
+
print("")
|
99
|
+
# Print the module identify and version information
|
100
|
+
print("Module Identity Information: ")
|
101
|
+
print(device1.sendCommand("*idn?"))
|
102
|
+
|
103
|
+
def get_QIS_version():
|
104
|
+
"""
|
105
|
+
Returns the version of QIS. This is the version of QIS currenty running on the local system if one exists.
|
106
|
+
Otherwise the local version within quarchpy will be exectued and its version returned.
|
107
|
+
|
108
|
+
Returns
|
109
|
+
-------
|
110
|
+
version: str
|
111
|
+
String representation of the QIS version number
|
112
|
+
|
113
|
+
"""
|
114
|
+
|
115
|
+
qis_version = ""
|
116
|
+
my_close_qis = False
|
117
|
+
if isQisRunning() == False:
|
118
|
+
my_close_qis = True
|
119
|
+
startLocalQis(headless=True)
|
120
|
+
|
121
|
+
myQis = qisInterface()
|
122
|
+
qis_version = myQis.sendAndReceiveCmd(cmd="$version")
|
123
|
+
if "No Target Device Specified" in qis_version:
|
124
|
+
qis_version = myQis.sendAndReceiveCmd(cmd="$help").split("\r\n")[0]
|
125
|
+
if my_close_qis:
|
126
|
+
myQis.sendAndReceiveCmd(cmd = "$shutdown")
|
127
|
+
return qis_version
|
128
|
+
|
129
|
+
def get_java_location():
|
130
|
+
"""
|
131
|
+
Returns the location of java.
|
132
|
+
|
133
|
+
Returns
|
134
|
+
-------
|
135
|
+
location: str
|
136
|
+
String representation of the java location.
|
137
|
+
"""
|
138
|
+
if "windows" in platform.platform().lower():
|
139
|
+
location = bytes(subprocess.check_output(['where', 'java'], stderr=subprocess.STDOUT)).decode()
|
140
|
+
elif "linux" in platform.platform().lower():
|
141
|
+
location = bytes(subprocess.check_output(['whereis', 'java'], stderr=subprocess.STDOUT)).decode()
|
142
|
+
else:
|
143
|
+
location = "Unable to detect OS to check java version."
|
144
|
+
return location
|
145
|
+
|
146
|
+
def get_quarchpy_version():
|
147
|
+
try:
|
148
|
+
return __version__
|
149
|
+
except:
|
150
|
+
return "Unknown"
|
151
|
+
|
152
|
+
def fix_usb():
|
153
|
+
content_to_write = "SUBSYSTEM==\"usb\", ATTRS{idVendor}==\"16d0\", MODE=\"0666\"" \
|
154
|
+
"SUBSYSTEM==\"usb_device\", ATTRS{idVendor}==\"16d0\", MODE=\"0666\""
|
155
|
+
|
156
|
+
if "centos" in str(platform.platform()).lower():
|
157
|
+
content_to_write = "SUBSYSTEM==\"usb\", ATTRS{idVendor}==\"16d0\", MODE=\"0666\", GROUP=*\n " \
|
158
|
+
"SUBSYSTEM==\"usb_device\", ATTRS{idVendor}==\"16d0\", MODE=\"0666\", GROUP=*"
|
159
|
+
|
160
|
+
destination = "/etc/udev/rules.d/20-quarchmodules.rules"
|
161
|
+
|
162
|
+
f = open("/etc/udev/rules.d/20-quarchmodules.rules", "w")
|
163
|
+
f.write(content_to_write)
|
164
|
+
f.close()
|
165
|
+
|
166
|
+
os.system("udevadm control --reload")
|
167
|
+
os.system("udevadm trigger")
|
168
|
+
|
169
|
+
print("USB rule added to file : /etc/udev/rules.d/20-quarchmodules.rules")
|
170
|
+
|
171
|
+
|
172
|
+
def main (args=None):
|
173
|
+
"""
|
174
|
+
Main function to allow the system test to be called direct from the command line
|
175
|
+
"""
|
176
|
+
bool_test_system_info = True
|
177
|
+
bool_test_communication = True
|
178
|
+
bool_fixusb=False
|
179
|
+
if args is not None and len(args)>0:
|
180
|
+
for arg in args:
|
181
|
+
if "--fixusb" in str(arg).lower():
|
182
|
+
bool_fixusb=True
|
183
|
+
# todo: Should we still be running the debug info stuff after this?
|
184
|
+
if "--skipsysteminfo" in str(arg).lower():
|
185
|
+
bool_test_system_info=False
|
186
|
+
if "--skipcommstest" in str(arg).lower():
|
187
|
+
bool_test_communication=False
|
188
|
+
|
189
|
+
if bool_fixusb:
|
190
|
+
fix_usb()
|
191
|
+
if bool_test_system_info:
|
192
|
+
test_system_info()
|
193
|
+
if bool_test_communication:
|
194
|
+
test_communication()
|
195
|
+
|
196
|
+
|
197
|
+
if __name__ == "__main__":
|
198
|
+
main([])
|
199
|
+
#main(["--skipSystemInfo","--skipCommsTest"])
|
200
|
+
#main(["--fixusb"])
|
Binary file
|
quarchpy/docs/CHANGES.rst
CHANGED
Binary file
|
Binary file
|
Binary file
|