summaryrefslogtreecommitdiff
path: root/tests/grub2-entries-crosscheck.py
diff options
context:
space:
mode:
authorJonathan Lebon <jonathan@jlebon.com>2018-04-19 09:58:51 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-04-23 18:33:45 +0000
commit8cfef187c5e80eac90a61fbbe98a0c7dd3ff9930 (patch)
tree502f81ce2aacf68da55e226e1c41c6ed14821e21 /tests/grub2-entries-crosscheck.py
parentd56058bc9a539ce344c669d26faaafe6c3071def (diff)
downloadostree-8cfef187c5e80eac90a61fbbe98a0c7dd3ff9930.tar.gz
tests: Port the last python2 script to python3
This is not used by any test, nor is it packaged. Though let's just port it over to py3 to certify our codebase completely py2-free. I've manually checked that the script is still functional. Closes: #1546 Approved by: cgwalters
Diffstat (limited to 'tests/grub2-entries-crosscheck.py')
-rw-r--r--tests/grub2-entries-crosscheck.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/grub2-entries-crosscheck.py b/tests/grub2-entries-crosscheck.py
index d68394d3..f2a68115 100644
--- a/tests/grub2-entries-crosscheck.py
+++ b/tests/grub2-entries-crosscheck.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
#
# Copyright (C) 2015 Red Hat
#
@@ -19,6 +19,7 @@
import os
import sys
+import functools
if len(sys.argv) == 1:
loaderpath = '/boot/loader/entries'
@@ -40,7 +41,7 @@ def get_ostree_option(optionstring):
if o.startswith('ostree='):
return o[8:]
raise ValueError('ostree= not found')
-
+
entries = []
grub2_entries = []
@@ -59,7 +60,7 @@ for fname in os.listdir(loaderpath):
v = line[s+1:]
entry[k] = v
entries.append(entry)
- entries.sort(compare_entries_descending)
+ entries.sort(key=functools.cmp_to_key(compare_entries_descending))
# Parse GRUB2 config
with open(grub2path) as f:
@@ -68,7 +69,7 @@ with open(grub2path) as f:
for line in f:
if line.startswith('### BEGIN /etc/grub.d/15_ostree ###'):
in_ostree_config = True
- elif line.startswith('### END /etc/grub.d/15_ostree ###'):
+ elif line.startswith('### END /etc/grub.d/15_ostree ###'):
in_ostree_config = False
if grub2_entry is not None:
grub2_entries.append(grub2_entry)