Skip to content
Snippets Groups Projects
Commit ec821c36 authored by Stéphane Diemer's avatar Stéphane Diemer
Browse files

Exit if no kernels.

parent 2dfe6aad
No related branches found
No related tags found
No related merge requests found
......@@ -48,6 +48,9 @@ def clean_kernels():
version = version[:-1]
version = [int(v) for v in version.replace('-', '.').split('.')]
kernels.append((line.split('\t')[0], version))
if not kernels:
log('No kernels found.')
return 1
log('Installed kernels:\n\t' + '\n\t'.join([n for n, v in kernels]))
# get current kernel
p = subprocess.Popen('uname -a', stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
......@@ -63,7 +66,7 @@ def clean_kernels():
current_str = current_str[:-8]
current = [int(v) for v in current_str.replace('-', '.').split('.')]
except Exception as e:
log(RED + 'Failed to get current kernel.' + DEFAULT + '\nError: ' + e, error=True)
log(RED + 'Failed to get current kernel.' + DEFAULT + '\nError: ' + str(e), error=True)
return 1
log('Current kernel is: ' + PURPLE + current_str + DEFAULT)
# get most recent kernel
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment