From 3cd5c1290de36039393b109cf43b5b2f357526fd Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Sun, 6 Apr 2025 15:20:29 -0700 Subject: [PATCH] Fix argument parsing to avoid using Python 3.12+ string features (#1057). --- NEWS | 4 ++++ borgmatic/commands/arguments.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index fb23e32a..4e556867 100644 --- a/NEWS +++ b/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!). diff --git a/borgmatic/commands/arguments.py b/borgmatic/commands/arguments.py index 8ed15cab..31575215 100644 --- a/borgmatic/commands/arguments.py +++ b/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.