Hi developers.
I upgraded my server to the fedora core 32 which completely drop Python2.
So I prepare some quick and dirty patch (I really dont know Python at
all) which makes hot-backup.py script working again under Python3
environment.
Maybe some real python programmer is able improve my patch and include
all fixes to the trunk.
Regards,
Peter
--
Ing. Petr Petyovsky, Ph.D.
Brno University of Technology
Faculty of Electrical Engineering and Communication
Department of Control and Instrumentation
Technicka 3082/12, 616 00 Brno
Czech Republic
European Union
--- hot-backup.py.orig 2020-06-11 13:06:59.979128055 +0200
+++ hot-backup.py 2020-06-11 13:01:55.431444221 +0200
@@ -36,6 +36,7 @@
######################################################################
import sys, os, getopt, stat, re, time, shutil, subprocess
+import functools
######################################################################
# Global Settings
@@ -219,7 +220,7 @@
raise Exception("Unable to find the youngest revision for repository '%s'"
": %s" % (repo_dir, stderr_lines[0].rstrip()))
- return stdout_lines[0].strip()
+ return stdout_lines[0].strip().decode();
######################################################################
# Main
@@ -255,7 +256,7 @@
directory_list = os.listdir(backup_dir)
young_list = [x for x in directory_list if regexp.search(x)]
if young_list:
- young_list.sort(comparator)
+ young_list.sort(key = functools.cmp_to_key(comparator))
increment = regexp.search(young_list.pop()).groupdict()['increment']
if increment:
backup_subdir = os.path.join(backup_dir, repo + "-" + youngest + "-"
@@ -348,7 +349,7 @@
regexp = re.compile("^" + re.escape(repo) + "-[0-9]+(-[0-9]+)?" + ext_re +
"$")
directory_list = os.listdir(backup_dir)
old_list = [x for x in directory_list if regexp.search(x)]
- old_list.sort(comparator)
+ old_list.sort(key = functools.cmp_to_key(comparator))
del old_list[max(0,len(old_list)-num_backups):]
for item in old_list:
old_backup_item = os.path.join(backup_dir, item)