Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-argcomplete for openSUSE:Factory checked in at 2024-01-05 22:59:50 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-argcomplete (Old) and /work/SRC/openSUSE:Factory/.python-argcomplete.new.28375 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-argcomplete" Fri Jan 5 22:59:50 2024 rev:31 rq:1136647 version:3.2.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-argcomplete/python-argcomplete.changes 2023-11-28 22:18:58.648844845 +0100 +++ /work/SRC/openSUSE:Factory/.python-argcomplete.new.28375/python-argcomplete.changes 2024-01-05 22:59:51.530868818 +0100 @@ -1,0 +2,16 @@ +Wed Jan 3 10:54:17 UTC 2024 - Ben Greiner <c...@bnavigator.de> + +- Remove coverage check +- Fix zsh test failures: avoid coloring terminal + +------------------------------------------------------------------- +Fri Dec 29 18:27:06 UTC 2023 - Dirk Müller <dmuel...@suse.com> + +- update to 3.2.1: + * Allow explicit zsh global completion activation (#467) + * Fix and test global completion in zsh (#463, #466) + * Add âyes option to activate-global-python-argcomplete (#461) + * Test suite improvements +- drop without_zsh.patch: obsolete + +------------------------------------------------------------------- Old: ---- argcomplete-3.1.6.tar.gz without_zsh.patch New: ---- argcomplete-3.2.1.tar.gz BETA DEBUG BEGIN: Old: * Test suite improvements - drop without_zsh.patch: obsolete BETA DEBUG END: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-argcomplete.spec ++++++ --- /var/tmp/diff_new_pack.LrC6L8/_old 2024-01-05 22:59:52.334898278 +0100 +++ /var/tmp/diff_new_pack.LrC6L8/_new 2024-01-05 22:59:52.338898424 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-argcomplete # -# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2024 SUSE LLC # Copyright (c) 2013 Darin Perusich. # # All modifications and additions to the file contributed by third parties @@ -19,26 +19,25 @@ %{?sle15_python_module_pythons} Name: python-argcomplete -Version: 3.1.6 +Version: 3.2.1 Release: 0 Summary: Bash tab completion for argparse 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 -# Don't fail the test suite when zsh is not available -Patch2: without_zsh.patch # Use correct place for auxiliary bashrc.sh file from pexpect Patch3: bash-repl.patch -BuildRequires: %{python_module coverage} +BuildRequires: %{python_module base >= 3.8} BuildRequires: %{python_module pexpect} BuildRequires: %{python_module pip} -BuildRequires: %{python_module setuptools >= 67.7.2} +BuildRequires: %{python_module setuptools >= 67.2} BuildRequires: %{python_module setuptools_scm >= 6.2} BuildRequires: %{python_module wheel} BuildRequires: ca-certificates BuildRequires: fdupes BuildRequires: python-rpm-macros +BuildRequires: zsh Requires(post): update-alternatives Requires(postun):update-alternatives BuildArch: noarch @@ -62,25 +61,24 @@ %autosetup -p1 -n argcomplete-%{version} %build -%python_build +%pyproject_wheel %install -%python_install +%pyproject_install %python_clone -a %{buildroot}%{_bindir}/register-python-argcomplete %python_clone -a %{buildroot}%{_bindir}/python-argcomplete-check-easy-install-script -rm -rf %{buildroot}%{python_sitelib}/test rm %{buildroot}%{_bindir}/activate-global-python-argcomplete %python_expand %fdupes %{buildroot}%{$python_sitelib} %check export LANG=en_US.UTF-8 +export TERM=xterm-mono %{python_expand \ # https://github.com/kislyuk/argcomplete/issues/255 - # https://github.com/kislyuk/argcomplete/issues/256 # https://github.com/kislyuk/argcomplete/issues/299 - sed -i -e "1s|#!.*python.*|#!%{_bindir}/$python|" test/prog scripts/* + sed -i -e "1s|#!.*python.*|#!%{__$python}|" test/prog test/*.py scripts/* sed -i -e "s|python3 |$python |g" test/test.py - PYTHONPATH=%{buildroot}%{$python_sitelib} $python -m coverage run --source=argcomplete --omit=argcomplete/packages/_shlex.py ./test/test.py -v + PYTHONPATH=%{buildroot}%{$python_sitelib} $python ./test/test.py -v } %post @@ -94,7 +92,7 @@ %files %{python_files} %doc README.rst %license LICENSE.rst -%{python_sitelib}/argcomplete-%{version}*-info +%{python_sitelib}/argcomplete-%{version}.dist-info %{python_sitelib}/argcomplete %python_alternative %{_bindir}/python-argcomplete-check-easy-install-script %python_alternative %{_bindir}/register-python-argcomplete ++++++ argcomplete-3.1.6.tar.gz -> argcomplete-3.2.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-3.1.6/.github/workflows/ci.yml new/argcomplete-3.2.1/.github/workflows/ci.yml --- old/argcomplete-3.1.6/.github/workflows/ci.yml 2023-11-01 16:11:23.000000000 +0100 +++ new/argcomplete-3.2.1/.github/workflows/ci.yml 2023-12-10 04:27:05.000000000 +0100 @@ -21,6 +21,9 @@ run: | [[ $(uname) == Linux ]] && sudo apt-get install --yes rpm tcsh fish zsh [[ $(uname) == Darwin ]] && brew install bash tcsh fish + # Some runners have python-argcomplete preinstalled + # as a dependency of pipx, which interferes with the tests. + [[ $(uname) == Darwin ]] && brew uninstall --ignore-dependencies python-argcomplete || true python -m pip install --quiet --upgrade codecov - run: make install - run: make lint @@ -29,8 +32,10 @@ black: runs-on: ubuntu-22.04 steps: + - uses: actions/checkout@v4 - uses: psf/black@stable isort: runs-on: ubuntu-22.04 steps: + - uses: actions/checkout@v4 - uses: isort/isort-action@v1.1.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-3.1.6/Changes.rst new/argcomplete-3.2.1/Changes.rst --- old/argcomplete-3.1.6/Changes.rst 2023-11-12 22:29:10.000000000 +0100 +++ new/argcomplete-3.2.1/Changes.rst 2023-12-10 16:15:33.000000000 +0100 @@ -1,3 +1,17 @@ +Changes for v3.2.1 (2023-12-10) +=============================== + +- Allow explicit zsh global completion activation (#467) + +Changes for v3.2.0 (2023-12-09) +=============================== + +- Fix and test global completion in zsh (#463, #466) + +- Add âyes option to activate-global-python-argcomplete (#461) + +- Test suite improvements + Changes for v3.1.6 (2023-11-12) =============================== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-3.1.6/PKG-INFO new/argcomplete-3.2.1/PKG-INFO --- old/argcomplete-3.1.6/PKG-INFO 2023-11-12 22:29:23.576081000 +0100 +++ new/argcomplete-3.2.1/PKG-INFO 2023-12-10 16:15:51.148905500 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: argcomplete -Version: 3.1.6 +Version: 3.2.1 Summary: Bash tab completion for argparse Home-page: https://github.com/kislyuk/argcomplete Author: Andrey Kislyuk diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-3.1.6/argcomplete/_check_console_script.py new/argcomplete-3.2.1/argcomplete/_check_console_script.py --- old/argcomplete-3.1.6/argcomplete/_check_console_script.py 2023-11-01 16:11:23.000000000 +0100 +++ new/argcomplete-3.2.1/argcomplete/_check_console_script.py 2023-11-19 22:17:53.000000000 +0100 @@ -13,12 +13,11 @@ """ import os import sys - -from importlib.metadata import entry_points as importlib_entry_points from importlib.metadata import EntryPoint +from importlib.metadata import entry_points as importlib_entry_points +from typing import Iterable from ._check_module import ArgcompleteMarkerNotFound, find -from typing import Iterable def main(): @@ -29,15 +28,14 @@ # assuming it is actually a console script. name = os.path.basename(script_path) - entry_points : Iterable[EntryPoint] = importlib_entry_points() # type:ignore + entry_points: Iterable[EntryPoint] = importlib_entry_points() # type:ignore # Python 3.12+ returns a tuple of entry point objects # whereas <=3.11 returns a SelectableGroups object if sys.version_info < (3, 12): - entry_points = entry_points["console_scripts"] # type:ignore + entry_points = entry_points["console_scripts"] # type:ignore - entry_points = [ep for ep in entry_points \ - if ep.name == name and ep.group == "console_scripts" ] # type:ignore + entry_points = [ep for ep in entry_points if ep.name == name and ep.group == "console_scripts"] # type:ignore if not entry_points: raise ArgcompleteMarkerNotFound("no entry point found matching script") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-3.1.6/argcomplete/bash_completion.d/_python-argcomplete new/argcomplete-3.2.1/argcomplete/bash_completion.d/_python-argcomplete --- old/argcomplete-3.1.6/argcomplete/bash_completion.d/_python-argcomplete 2023-11-12 21:07:54.000000000 +0100 +++ new/argcomplete-3.2.1/argcomplete/bash_completion.d/_python-argcomplete 2023-12-10 16:15:17.000000000 +0100 @@ -1,10 +1,15 @@ -#compdef -P * +#compdef -default- # Copyright 2012-2023, Andrey Kislyuk and argcomplete contributors. # Licensed under the Apache License. See https://github.com/kislyuk/argcomplete for more info. # Note: both the leading underscore in the name of this file and the first line (compdef) are required by zsh +# In zsh, this file is autoloaded and used as the default completer (_default). +# There are many other special contexts we don't want to override +# (as would be the case with `#compdef -P *`). +# https://zsh.sourceforge.io/Doc/Release/Completion-System.html + # Copy of __expand_tilde_by_ref from bash-completion # ZSH implementation added __python_argcomplete_expand_tilde_by_ref () { @@ -138,12 +143,6 @@ req_argv=( "" "${COMP_WORDS[@]:1}" ) __python_argcomplete_expand_tilde_by_ref executable else - if [[ "$service" != "-default-" ]]; then - # TODO: this may not be sufficient - see https://zsh.sourceforge.io/Doc/Release/Completion-System.html - # May need to call _complete with avoid-completer=_python-argcomplete or something like that - _default - return - fi executable="${words[1]}" req_argv=( "${words[@]:1}" ) fi @@ -208,7 +207,15 @@ _ARGCOMPLETE_SHELL="zsh" \ _ARGCOMPLETE_SUPPRESS_SPACE=1 \ __python_argcomplete_run "$executable" "${(@)req_argv[1, ${ARGCOMPLETE}-1]}")) - _describe "$executable" completions + local nosort=() + local nospace=() + if is-at-least 5.8; then + nosort=(-o nosort) + fi + if [[ "${completions-}" =~ ([^\\]): && "${BASH_REMATCH[2]}" =~ [=/:] ]]; then + nospace=(-S '') + fi + _describe "$executable" completions "${nosort[@]}" "${nospace[@]}" else COMPREPLY=($(IFS="$IFS" \ COMP_LINE="$COMP_LINE" \ @@ -234,5 +241,20 @@ if [[ -z "${ZSH_VERSION-}" ]]; then complete -o default -o bashdefault -D -F _python_argcomplete_global else - compdef _python_argcomplete_global -P '*' + # -Uz is recommended for the use of functions supplied with the zsh distribution. + # https://unix.stackexchange.com/a/214306 + autoload -Uz is-at-least + # If this is being implicitly loaded because we placed it on fpath, + # the comment at the top of this file causes zsh to invoke this script directly, + # so we must explicitly call the global completion function. + # Note $service should only ever be -default- because the comment at the top + # registers this script as the default completer (#compdef -default-). + if [[ $service == -default- ]]; then + _python_argcomplete_global + fi + # If this has been executed directly (e.g. `eval "$(activate-global-python-argcomplete --dest=-)"`) + # we need to explicitly call compdef to register the completion function. + # If we have been implicitly loaded, we still call compdef as a slight optimisation + # (there is no need to execute any top-level code more than once). + compdef _python_argcomplete_global -default- fi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-3.1.6/argcomplete/shell_integration.py new/argcomplete-3.2.1/argcomplete/shell_integration.py --- old/argcomplete-3.1.6/argcomplete/shell_integration.py 2023-11-01 16:11:23.000000000 +0100 +++ new/argcomplete-3.2.1/argcomplete/shell_integration.py 2023-12-03 02:57:10.000000000 +0100 @@ -42,7 +42,15 @@ _ARGCOMPLETE_SHELL="zsh" \ _ARGCOMPLETE_SUPPRESS_SPACE=1 \ __python_argcomplete_run ${script:-${words[1]}})) - _describe "${words[1]}" completions -o nosort + local nosort=() + local nospace=() + if is-at-least 5.8; then + nosort=(-o nosort) + fi + if [[ "${completions-}" =~ ([^\\]): && "${match[1]}" =~ [=/:] ]]; then + nospace=(-S '') + fi + _describe "${words[1]}" completions "${nosort[@]}" "${nospace[@]}" else local SUPPRESS_SPACE=0 if compopt +o nospace 2> /dev/null; then @@ -67,6 +75,7 @@ if [[ -z "${ZSH_VERSION-}" ]]; then complete %(complete_opts)s -F _python_argcomplete%(function_suffix)s %(executables)s else + autoload is-at-least compdef _python_argcomplete%(function_suffix)s %(executables)s fi """ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-3.1.6/argcomplete.egg-info/PKG-INFO new/argcomplete-3.2.1/argcomplete.egg-info/PKG-INFO --- old/argcomplete-3.1.6/argcomplete.egg-info/PKG-INFO 2023-11-12 22:29:23.000000000 +0100 +++ new/argcomplete-3.2.1/argcomplete.egg-info/PKG-INFO 2023-12-10 16:15:51.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: argcomplete -Version: 3.1.6 +Version: 3.2.1 Summary: Bash tab completion for argparse Home-page: https://github.com/kislyuk/argcomplete Author: Andrey Kislyuk diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-3.1.6/scripts/activate-global-python-argcomplete new/argcomplete-3.2.1/scripts/activate-global-python-argcomplete --- old/argcomplete-3.1.6/scripts/activate-global-python-argcomplete 2023-11-12 22:27:25.000000000 +0100 +++ new/argcomplete-3.2.1/scripts/activate-global-python-argcomplete 2023-12-03 02:13:18.000000000 +0100 @@ -81,6 +81,8 @@ def get_consent(): + if args.yes is True: + return True while True: res = input("OK to proceed? [y/n] ") if res.lower() not in {"y", "n", "yes", "no"}: @@ -93,6 +95,10 @@ def append_to_config_file(path, shellcode): if os.path.exists(path): + with open(path, 'r') as fh: + if shellcode in fh.read(): + print(f"The code already exists in the file {path}.", file=sys.stderr) + return print(f"argcomplete needs to append to the file {path}. The following code will be appended:", file=sys.stderr) for line in shellcode.splitlines(): print(">", line, file=sys.stderr) @@ -115,6 +121,7 @@ parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) +parser.add_argument("-y", "--yes", help="automatically answer yes for all questions", action="store_true") parser.add_argument("--dest", help='Specify the shell completion modules directory to install into, or "-" for stdout') parser.add_argument("--user", help="Install into user directory", action="store_true") argcomplete.autocomplete(parser) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-3.1.6/test/test.py new/argcomplete-3.2.1/test/test.py --- old/argcomplete-3.1.6/test/test.py 2023-11-12 22:07:42.000000000 +0100 +++ new/argcomplete-3.2.1/test/test.py 2023-12-10 16:15:17.000000000 +0100 @@ -8,6 +8,7 @@ import subprocess import sys import unittest +import unittest.util from io import StringIO from tempfile import NamedTemporaryFile, TemporaryFile, mkdtemp @@ -33,6 +34,9 @@ from argcomplete.completers import DirectoriesCompleter, FilesCompleter, SuppressCompleter # noqa: E402 from argcomplete.lexers import split_line # noqa: E402 +# Default max length is insufficient for troubleshooting. +unittest.util._MAX_LENGTH = 1000 + IFS = "\013" COMP_WORDBREAKS = " \t\n\"'><=;|&(:" @@ -50,7 +54,11 @@ raise Exception("Expected to see a newline in command response") echo_cmd, actual_res = res.split("\n", 1) res_without_ansi_seqs = re.sub(r"\x1b\[0m.+\x1b\[J", "", actual_res) - return res_without_ansi_seqs + # Unsure why some environments produce trailing null characters, + # but they break tests and trimming them seems to be harmless. + # https://github.com/kislyuk/argcomplete/issues/447 + res_without_null_chars = res_without_ansi_seqs.rstrip("\x00") + return res_without_null_chars else: return res @@ -72,7 +80,8 @@ def zsh_repl(command="zsh"): sh = _repl_sh(command, ["--no-rcs", "-V"], non_printable_insert="%(!..)") - sh.run_command("autoload compinit; compinit -u") + # Require two tabs to print all options (some tests rely on this). + sh.run_command("setopt BASH_AUTO_LIST") return sh @@ -1239,20 +1248,26 @@ class TestBashZshBase(TestShellBase): + maxDiff = None + + init_cmd = None # 'dummy' argument unused; checks multi-command registration works # by passing 'prog' as the second argument. install_cmd = 'eval "$(register-python-argcomplete dummy prog)"' def setUp(self): sh = self.repl_provider() + output = sh.run_command("echo ready") + self.assertEqual(output, "ready\r\n") path = ":".join([os.path.join(BASE_DIR, "scripts"), TEST_DIR, "$PATH"]) sh.run_command("export PATH={0}".format(path)) sh.run_command("export PYTHONPATH={0}".format(BASE_DIR)) - if self.repl_provider == bash_repl: - # Disable the "python" module provided by bash-completion - sh.run_command("complete -r python python2 python3") - output = sh.run_command(self.install_cmd) - self.assertEqual(output, "") + if self.init_cmd is not None: + output = sh.run_command(self.init_cmd) + self.assertEqual(output, "") + if self.install_cmd is not None: + output = sh.run_command(self.install_cmd) + self.assertEqual(output, "") # Register a dummy completion with an external argcomplete script # to ensure this doesn't overwrite our previous registration. output = sh.run_command('eval "$(register-python-argcomplete dummy --external-argcomplete-script dummy)"') @@ -1300,23 +1315,31 @@ class TestZsh(TestBashZshBase, unittest.TestCase): + init_cmd = "autoload compinit; compinit -u" + skipped = [ "test_parse_special_characters", "test_parse_special_characters_dollar", "test_comp_point", # FIXME "test_completion_environment", # FIXME - "test_continuation", # FIXME - "test_wordbreak_chars", # FIXME ] def repl_provider(self): return zsh_repl() -@unittest.skipIf(BASH_MAJOR_VERSION < 4, "complete -D not supported") -class TestBashGlobal(TestBash): +class TestBashZshGlobalBase(TestBashZshBase): install_cmd = 'eval "$(activate-global-python-argcomplete --dest=-)"' + def test_redirection_completion(self): + with TempDir(prefix="test_dir_py", dir="."): + self.sh.run_command("cd " + os.getcwd()) + self.sh.run_command("echo failure > ./foo.txt") + self.sh.run_command("echo success > ./foo.\t") + with open("foo.txt") as f: + msg = f.read() + self.assertEqual(msg, "success\n") + def test_python_completion(self): self.sh.run_command("cd " + TEST_DIR) self.assertEqual(self.sh.run_command("python3 ./prog basic f\t"), "foo\r\n") @@ -1356,9 +1379,6 @@ command = "pip install {} --target .".format(test_package) if not wheel: command += " --no-binary :all:" - if sys.platform == "darwin": - # Work around https://stackoverflow.com/questions/24257803 - command += ' --install-option="--prefix="' install_output = self.sh.run_command(command) self.assertEqual(self.sh.run_command("echo $?"), "0\r\n", install_output) command = "test-module" @@ -1367,27 +1387,40 @@ command += " a\t" self.assertEqual(self.sh.run_command(command), "arg\r\n") - @unittest.skipIf(os.uname()[0] == "Darwin", "Skip test that fails on MacOS") def test_console_script_module(self): """Test completing a console_script for a module.""" self._test_console_script() - @unittest.skipIf(os.uname()[0] == "Darwin", "Skip test that fails on MacOS") def test_console_script_package(self): """Test completing a console_script for a package.""" self._test_console_script(package=True) - @unittest.skipIf(os.uname()[0] == "Darwin", "Skip test that fails on MacOS") def test_console_script_module_wheel(self): """Test completing a console_script for a module from a wheel.""" self._test_console_script(wheel=True) - @unittest.skipIf(os.uname()[0] == "Darwin", "Skip test that fails on MacOS") def test_console_script_package_wheel(self): """Test completing a console_script for a package from a wheel.""" self._test_console_script(package=True, wheel=True) +@unittest.skipIf(BASH_MAJOR_VERSION < 4, "complete -D not supported") +class TestBashGlobal(TestBash, TestBashZshGlobalBase): + pass + + +class TestZshGlobalExplicit(TestZsh, TestBashZshGlobalBase): + pass + + +class TestZshGlobalImplicit(TestZsh, TestBashZshGlobalBase): + # In zsh, the file is typically not sourced directly; + # it is added to fpath and autoloaded by the completion system. + zsh_fpath = os.path.join(os.path.abspath(os.path.dirname(argcomplete.__file__)), "bash_completion.d") + init_cmd = f'fpath=( {zsh_fpath} "${{fpath[@]}}" ); autoload compinit; compinit -u' + install_cmd = None + + class Shell: def __init__(self, shell): self.child = pexpect.spawn(shell, encoding="utf-8")