File 0001-Fix-Python-3.12-compatibility.patch of Package python-novaclient
From d27282b5c76c6d4f99d82de439d6c52dfd219faf Mon Sep 17 00:00:00 2001
From: Stephen Finucane <stephenfin@redhat.com>
Date: Tue, 27 Aug 2024 10:29:51 +0100
Subject: [PATCH] Fix Python 3.12 compatibility
Handle a change in Python 3.12 [1].
[1] https://github.com/python/cpython/commit/cffb4c78d3b2a8a724301e59fb39b73b20e544de
Change-Id: I772579d297ef51c57019218a4ca8a566987b9b5c
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
---
novaclient/shell.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/novaclient/shell.py b/novaclient/shell.py
index adb8b4dc..49cba94f 100644
--- a/novaclient/shell.py
+++ b/novaclient/shell.py
@@ -232,8 +232,11 @@ class NovaClientArgumentParser(argparse.ArgumentParser):
option_tuples = (super(NovaClientArgumentParser, self)
._get_option_tuples(option_string))
if len(option_tuples) > 1:
- normalizeds = [option.replace('_', '-')
- for action, option, value in option_tuples]
+ # In Python < 3.12, this is a 3-part tuple:
+ # action, option_string, explicit_arg
+ # In Python >= 3.12, this is a 4 part tuple:
+ # action, option_string, sep, explicit_arg
+ normalizeds = [opt[1].replace('_', '-') for opt in option_tuples]
if len(set(normalizeds)) == 1:
return option_tuples[:1]
return option_tuples
--
2.46.0