import argparse
import collections
+import functools
import os
import rpm
import shlex
return [name, spec, branch]
def run_command(command, verbose=False, quiet=True):
- gitproc = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=-1)
+ gitproc = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=-1, text=True)
gitproc.wait()
out = gitproc.stdout.read().strip("\n'")
if verbose:
def csv_list(string):
return string.split(',')
+# TDOD: convert this to key function
+# https://docs.python.org/3/library/stdtypes.html#list.sort
def kernel_cmp(x, y):
x = x.split('.')
y = y.split('.')
'dist': args.dist,
'source_packages': ' '.join(source_packages)})
run_command(shlex.split(command), verbose=args.verbose, quiet=False)
- raw_input('\nPress Enter after src builder updates kernel packages...')
+ input('\nPress Enter after src builder updates kernel packages...')
print('\nCurrent kernels versions:')
all_kernels = set()
for kernel_list in packages.values():
all_kernels.update(kernel_list)
all_kernels = list(all_kernels)
- all_kernels.sort(cmp=kernel_cmp, reverse=True)
+ # TDOD: convert this to key function
+ # https://docs.python.org/3/library/stdtypes.html#list.sort
+ all_kernels.sort(key=functools.cmp_to_key(kernel_cmp), reverse=True)
for kernel in all_kernels:
branch = 'master'
if kernel != 'head':