From 749886ae5f1d6c7d953308db193e0eb8c7e42ddb7416342a6bfa19e3d11ef728 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Sun, 6 Oct 2024 21:46:10 +0000 Subject: [PATCH] - Add argparse-3_12_7.patch which should actually fix gh#kislyuk/argcomplete#507. - Remove skip-failing-tests-3_12_7.patch, which is now unnecessary. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-argcomplete?expand=0&rev=78 --- argparse-3_12_7.patch | 22 ++++++ python-argcomplete.changes | 8 ++ python-argcomplete.spec | 6 +- skip-failing-tests-3_12_7.patch | 126 -------------------------------- 4 files changed, 33 insertions(+), 129 deletions(-) create mode 100644 argparse-3_12_7.patch delete mode 100644 skip-failing-tests-3_12_7.patch diff --git a/argparse-3_12_7.patch b/argparse-3_12_7.patch new file mode 100644 index 0000000..c5b0775 --- /dev/null +++ b/argparse-3_12_7.patch @@ -0,0 +1,22 @@ +From 480d112ba488fa6825db877201577270053dacce Mon Sep 17 00:00:00 2001 +From: Eggry Ran +Date: Sun, 6 Oct 2024 16:16:49 +0800 +Subject: [PATCH] Fix issue #507 + +--- + argcomplete/packages/_argparse.py | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/argcomplete/packages/_argparse.py b/argcomplete/packages/_argparse.py +index 2a064f9..d10cf01 100644 +--- a/argcomplete/packages/_argparse.py ++++ b/argcomplete/packages/_argparse.py +@@ -162,6 +162,8 @@ def take_action(action, argument_strings, option_string=None): + def consume_optional(start_index): + # get the optional identified at this index + option_tuple = option_string_indices[start_index] ++ if isinstance(option_tuple, list): # Python 3.12.7+ ++ option_tuple = option_tuple[0] + if len(option_tuple) == 3: + action, option_string, explicit_arg = option_tuple + else: # Python 3.11.9+, 3.12.3+, 3.13+ diff --git a/python-argcomplete.changes b/python-argcomplete.changes index c5b9328..cc53cf3 100644 --- a/python-argcomplete.changes +++ b/python-argcomplete.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Sun Oct 6 21:27:22 UTC 2024 - Matej Cepl + +- Add argparse-3_12_7.patch which should actually fix + gh#kislyuk/argcomplete#507. +- Remove skip-failing-tests-3_12_7.patch, which is now + unnecessary. + ------------------------------------------------------------------- Sat Oct 5 14:53:29 UTC 2024 - Matej Cepl diff --git a/python-argcomplete.spec b/python-argcomplete.spec index f1242d3..68e6bf7 100644 --- a/python-argcomplete.spec +++ b/python-argcomplete.spec @@ -26,9 +26,9 @@ License: Apache-2.0 Group: Development/Languages/Python URL: https://github.com/kislyuk/argcomplete Source: https://files.pythonhosted.org/packages/source/a/argcomplete/argcomplete-%{version}.tar.gz -# PATCH-FIX-OPENSUSE skip-failing-tests-3_12_7.patch gh#kislyuk/argcomplete#507 mcepl@suse.com -# temporary workaround, skip failing tests -Patch0: skip-failing-tests-3_12_7.patch +# PATCH-FIX-OPENSUSE argparse-3_12_7.patch gh#kislyuk/argcomplete#507 mcepl@suse.com +# fix the incompatibility with Python 3.12.7+ +Patch0: argparse-3_12_7.patch BuildRequires: %{python_module base >= 3.8} BuildRequires: %{python_module pexpect} BuildRequires: %{python_module pip} diff --git a/skip-failing-tests-3_12_7.patch b/skip-failing-tests-3_12_7.patch deleted file mode 100644 index b485e20..0000000 --- a/skip-failing-tests-3_12_7.patch +++ /dev/null @@ -1,126 +0,0 @@ ---- - test/test.py | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - ---- a/test/test.py -+++ b/test/test.py -@@ -43,6 +43,7 @@ COMP_WORDBREAKS = " \t\n\"'><=;|&(:" - BASH_VERSION = subprocess.check_output(["bash", "-c", "echo $BASH_VERSION"]).decode() - BASH_MAJOR_VERSION = int(BASH_VERSION.split(".")[0]) - -+is_3_12_7 = sys.version_info[:2] == (3, 12) and sys.version_info[:3] >= (3, 12, 7) - - class ArgcompleteREPLWrapper(REPLWrapper): - def run_command(self, command, **kwargs): -@@ -158,6 +159,7 @@ class TestArgcomplete(unittest.TestCase) - completions = self.run_completer(p, "prog -", always_complete_options=False) - self.assertEqual(set(completions), set(["-h", "--help", "--foo", "--bar"])) - -+ @unittest.skipIf(is_3_12_7, "Doesn't work with Python 3.12.7") - def test_choices(self): - def make_parser(): - parser = ArgumentParser() -@@ -274,6 +276,7 @@ class TestArgcomplete(unittest.TestCase) - for cmd, output in expected_outputs: - self.assertEqual(set(self.run_completer(make_parser(), cmd)), set(output)) - -+ @unittest.skipIf(is_3_12_7, "Doesn't work with Python 3.12.7") - def test_completers(self): - self.completions = ["http://url1", "http://url2"] - -@@ -317,6 +320,7 @@ class TestArgcomplete(unittest.TestCase) - for cmd, output in zsh_expected_outputs: - self.assertEqual(set(self.run_completer(make_parser(), cmd, shell="zsh")), set(output)) - -+ @unittest.skipIf(is_3_12_7, "Doesn't work with Python 3.12.7") - def test_subparser_completers(self): - def c_depends_on_positional_arg1(prefix, parsed_args, **kwargs): - return [parsed_args.arg1] -@@ -355,6 +359,7 @@ class TestArgcomplete(unittest.TestCase) - fp.write("test") - self.assertEqual(set(fc("a")), set(["abcdefж/", "abcaha/", "abcxyz"])) - -+ @unittest.skipIf(is_3_12_7, "Doesn't work with Python 3.12.7") - def test_filescompleter_filetype_integration(self): - def make_parser(): - parser = ArgumentParser() -@@ -404,6 +409,7 @@ class TestArgcomplete(unittest.TestCase) - self.assertEqual(c("def/k"), set([])) - return - -+ @unittest.skipIf(is_3_12_7, "Doesn't work with Python 3.12.7") - def test_default_completer(self): - def make_parser(): - parser = ArgumentParser(add_help=False) -@@ -423,6 +429,7 @@ class TestArgcomplete(unittest.TestCase) - for cmd, output in expected_outputs: - self.assertEqual(set(self.run_completer(make_parser(), cmd)), set(output)) - -+ @unittest.skipIf(is_3_12_7, "Doesn't work with Python 3.12.7") - def test_subparsers(self): - def make_parser(): - parser = ArgumentParser() -@@ -455,6 +462,7 @@ class TestArgcomplete(unittest.TestCase) - set(output) - set(["-h", "--help"]), - ) - -+ @unittest.skipIf(is_3_12_7, "Doesn't work with Python 3.12.7") - def test_non_ascii(self): - def make_parser(): - parser = ArgumentParser() -@@ -664,6 +672,7 @@ class TestArgcomplete(unittest.TestCase) - for cmd, output in expected_outputs: - self.assertEqual(set(self.run_completer(make_parser(), cmd)), set(output)) - -+ @unittest.skipIf(is_3_12_7, "Doesn't work with Python 3.12.7") - def test_optional_nargs(self): - def make_parser(): - parser = ArgumentParser() -@@ -696,6 +705,7 @@ class TestArgcomplete(unittest.TestCase) - for cmd, output in expected_outputs: - self.assertEqual(set(self.run_completer(make_parser(), cmd)), set(output)) - -+ @unittest.skipIf(is_3_12_7, "Doesn't work with Python 3.12.7") - def test_positional_remainder(self): - def make_parser(): - parser = ArgumentParser() -@@ -753,6 +763,7 @@ class TestArgcomplete(unittest.TestCase) - result = self.run_completer(make_parser(), cmd, always_complete_options=always_complete_options) - self.assertEqual(set(result), set(output)) - -+ @unittest.skipIf(is_3_12_7, "Doesn't work with Python 3.12.7") - def test_exclusive(self): - def make_parser(): - parser = ArgumentParser(add_help=False) -@@ -772,6 +783,7 @@ class TestArgcomplete(unittest.TestCase) - for cmd, output in expected_outputs: - self.assertEqual(set(self.run_completer(make_parser(), cmd)), set(output)) - -+ @unittest.skipIf(is_3_12_7, "Doesn't work with Python 3.12.7") - def test_mixed_optional_positional(self): - def make_parser(): - parser = ArgumentParser(add_help=False) -@@ -801,6 +813,7 @@ class TestArgcomplete(unittest.TestCase) - self.assertEqual(self.run_completer(make_parser(), "prog "), ["bar "]) - self.assertEqual(self.run_completer(make_parser(), "prog ", append_space=False), ["bar"]) - -+ @unittest.skipIf(is_3_12_7, "Doesn't work with Python 3.12.7") - def test_exclusive_class(self): - parser = ArgumentParser(add_help=False) - parser.add_argument("--foo", dest="types", action="append_const", const=str) -@@ -821,6 +834,7 @@ class TestArgcomplete(unittest.TestCase) - for cmd, output in expected_outputs: - self.assertEqual(set(self.run_completer(parser, cmd, completer=completer)), set(output)) - -+ @unittest.skipIf(is_3_12_7, "Doesn't work with Python 3.12.7") - def test_escape_special_chars(self): - def make_parser(): - parser = ArgumentParser(add_help=False) -@@ -921,6 +935,7 @@ class TestArgcompleteREPL(unittest.TestC - completions = self.run_completer(p, c, "prog --") - assert set(completions) == set(["--help", "--foo", "--bar"]) - -+ @unittest.skipIf(is_3_12_7, "Doesn't work with Python 3.12.7") - def test_repl_parse_after_complete(self): - p = ArgumentParser() - p.add_argument("--foo", required=True)