Răsfoiți Sursa

Fix argument parsing to avoid using Python 3.12+ string features (#1057).

Dan Helfman 1 lună în urmă
părinte
comite
3cd5c1290d
2 a modificat fișierele cu 5 adăugiri și 1 ștergeri
  1. 4 0
      NEWS
  2. 1 1
      borgmatic/commands/arguments.py

+ 4 - 0
NEWS

@@ -1,3 +1,7 @@
+2.0.1
+ * #1057: Fix argument parsing to avoid using Python 3.12+ string features. Now borgmatic will
+   work with Python 3.9, 3.10, and 3.11 again.
+
 2.0.0
  * TL;DR: More flexible, completely revamped command hooks. All configuration options settable on
    the command-line. New configuration options for many command-line flags (including verbosity!).

+ 1 - 1
borgmatic/commands/arguments.py

@@ -357,7 +357,7 @@ def add_array_element_arguments(arguments_group, unparsed_arguments, flag_name):
     if '[0]' not in flag_name or not unparsed_arguments or '--help' in unparsed_arguments:
         return
 
-    pattern = re.compile(fr'^--{flag_name.replace("[0]", r"\[\d+\]").replace(".", r"\.")}$')
+    pattern = re.compile('^--' + flag_name.replace('[0]', r'\[\d+\]').replace('.', r'\.') + '$')
 
     try:
         # Find an existing list index flag (and its action) corresponding to the given flag name.