Improving update_dependencies by making pyjwt an optional update/install

Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
This commit is contained in:
Matthew Stidham
2021-09-15 18:47:29 -07:00
parent 2699610c0b
commit 53552f605f

View File

@@ -11,11 +11,22 @@ NOTES: Install as root
''' '''
import subprocess import subprocess
import argparse
def main(): def main():
parser = argparse.ArgumentParser()
parser.add_argument('--pyjwt', help='Install PyJWT which is necessary for GhostRequest', action="store_true")
args = parser.parse_args()
print("Installing Script Python3 Dependencies") print("Installing Script Python3 Dependencies")
packages = ['pandas', 'plotly', 'numpy', 'cryptography', 'paramiko', 'bokeh','pyarrow', 'websocket-client', 'xlsxwriter',\ packages = ['pandas', 'plotly', 'numpy', 'cryptography', 'paramiko', 'bokeh','pyarrow', 'websocket-client', 'xlsxwriter',\
'pyshark', 'influxdb', 'influxdb-client', 'matplotlib', 'pdfkit', 'pip-search', 'pyserial', 'pexpect-serial' ,'scp', 'pyjwt',\ 'pyshark', 'influxdb', 'influxdb-client', 'matplotlib', 'pdfkit', 'pip-search', 'pyserial', 'pexpect-serial' ,'scp',\
'dash', 'kaleido'] 'dash', 'kaleido']
if args.pyjwt is True:
packages.append('pyjwt')
else:
print('Not installing PyJWT')
packages_installed = [] packages_installed = []
packages_failed =[] packages_failed =[]
subprocess.call("pip3 uninstall jwt", shell=True) subprocess.call("pip3 uninstall jwt", shell=True)
@@ -23,7 +34,7 @@ def main():
command = "pip3 install {} >/tmp/pip3-stdout 2>/tmp/pip3-stderr".format(package) command = "pip3 install {} >/tmp/pip3-stdout 2>/tmp/pip3-stderr".format(package)
res = subprocess.call(command, shell=True) res = subprocess.call(command, shell=True)
if res == 0: if res == 0:
#print("Package {} install SUCCESS Returned Value: {} ".format(package, res)) print("Package {} install SUCCESS Returned Value: {} ".format(package, res))
packages_installed.append(package) packages_installed.append(package)
else: else:
print("Package {} install FAILED Returned Value: {} ".format(package, res)) print("Package {} install FAILED Returned Value: {} ".format(package, res))