Przeglądaj źródła

Fix Python < 3.12 compatibility issue (#1005).

Dan Helfman 3 miesięcy temu
rodzic
commit
4f0142c3c5

+ 4 - 0
NEWS

@@ -1,3 +1,7 @@
+1.9.12.dev0
+ * #1005: Fix the credential hooks to avoid using Python 3.12+ string features. Now borgmatic will
+   work with Python 3.9, 3.10, and 3.11 again.
+
 1.9.11
  * #795: Add credential loading from file, KeePassXC, and Docker/Podman secrets. See the
    documentation for more information:

+ 3 - 1
borgmatic/hooks/credential/container.py

@@ -21,7 +21,9 @@ def load_credential(hook_config, config, credential_parameters):
     try:
         (secret_name,) = credential_parameters
     except ValueError:
-        raise ValueError(f'Cannot load invalid secret name: "{' '.join(credential_parameters)}"')
+        name = ' '.join(credential_parameters)
+
+        raise ValueError(f'Cannot load invalid secret name: "{name}"')
 
     if not SECRET_NAME_PATTERN.match(secret_name):
         raise ValueError(f'Cannot load invalid secret name: "{secret_name}"')

+ 3 - 1
borgmatic/hooks/credential/file.py

@@ -15,7 +15,9 @@ def load_credential(hook_config, config, credential_parameters):
     try:
         (credential_path,) = credential_parameters
     except ValueError:
-        raise ValueError(f'Cannot load invalid credential: "{' '.join(credential_parameters)}"')
+        name = ' '.join(credential_parameters)
+
+        raise ValueError(f'Cannot load invalid credential: "{name}"')
 
     try:
         with open(

+ 3 - 3
borgmatic/hooks/credential/systemd.py

@@ -20,9 +20,9 @@ def load_credential(hook_config, config, credential_parameters):
     try:
         (credential_name,) = credential_parameters
     except ValueError:
-        raise ValueError(
-            f'Cannot load invalid credential name: "{' '.join(credential_parameters)}"'
-        )
+        name = ' '.join(credential_parameters)
+
+        raise ValueError(f'Cannot load invalid credential name: "{name}"')
 
     credentials_directory = os.environ.get('CREDENTIALS_DIRECTORY')
 

+ 1 - 1
pyproject.toml

@@ -1,6 +1,6 @@
 [project]
 name = "borgmatic"
-version = "1.9.11"
+version = "1.9.12.dev0"
 authors = [
   { name="Dan Helfman", email="witten@torsion.org" },
 ]