Hello community, here is the log from the commit of package python-argcomplete for openSUSE:Factory checked in at 2020-01-17 16:07:32 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-argcomplete (Old) and /work/SRC/openSUSE:Factory/.python-argcomplete.new.26092 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-argcomplete" Fri Jan 17 16:07:32 2020 rev:13 rq:765227 version:1.11.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-argcomplete/python-argcomplete.changes 2019-09-27 14:47:29.860913100 +0200 +++ /work/SRC/openSUSE:Factory/.python-argcomplete.new.26092/python-argcomplete.changes 2020-01-17 16:07:54.564511637 +0100 @@ -1,0 +2,13 @@ +Fri Jan 17 10:42:58 UTC 2020 - Marketa Calabkova <[email protected]> + +- update to 1.11.1 + * Add -o bashdefault to register-python-argcomplete’s output command + * Use shell builtins where possible + * Switch from pkg_resources to importlib + * Remove .sh extension by bash-completion convention + * Do not suggest options after – + * Include all test directory contents in source distribution + * Trigger completers on –optional=PARTIAL_VALUE + * Documentation and test improvements + +------------------------------------------------------------------- Old: ---- argcomplete-1.10.0.tar.gz New: ---- argcomplete-1.11.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-argcomplete.spec ++++++ --- /var/tmp/diff_new_pack.7Ag8dX/_old 2020-01-17 16:07:56.152512389 +0100 +++ /var/tmp/diff_new_pack.7Ag8dX/_new 2020-01-17 16:07:56.152512389 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-argcomplete # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # Copyright (c) 2013 Darin Perusich. # # All modifications and additions to the file contributed by third parties @@ -19,7 +19,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-argcomplete -Version: 1.10.0 +Version: 1.11.1 Release: 0 Summary: Bash tab completion for argparse License: Apache-2.0 @@ -28,7 +28,9 @@ Source: https://files.pythonhosted.org/packages/source/a/argcomplete/argcomplete-%{version}.tar.gz Patch0: skip_tcsh_tests.patch Patch1: trim-test-deps.patch +BuildRequires: %{python_module importlib-metadata} BuildRequires: %{python_module pexpect} +BuildRequires: %{python_module pip} BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: fish @@ -63,13 +65,12 @@ rm -rf %{buildroot}%{python_sitelib}/test rm %{buildroot}%{_bindir}/activate-global-python-argcomplete %python_expand %fdupes %{buildroot}%{$python_sitelib} -install -DTm644 %{buildroot}%{python_sitelib}/argcomplete/bash_completion.d/python-argcomplete.sh %{buildroot}%{_datadir}/bash-completion/completions/python-argcomplete.sh # tcsh support is broken rm %{buildroot}%{_bindir}/python-argcomplete-tcsh %check export LANG=en_US.UTF-8 -%python_exec setup.py test +%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} $python -m unittest discover -v %files %{python_files} %doc README.rst @@ -78,6 +79,5 @@ %{python_sitelib}/argcomplete %python3_only %{_bindir}/python-argcomplete-check-easy-install-script %python3_only %{_bindir}/register-python-argcomplete -%python3_only %{_datadir}/bash-completion/completions/python-argcomplete.sh %changelog ++++++ argcomplete-1.10.0.tar.gz -> argcomplete-1.11.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-1.10.0/Changes.rst new/argcomplete-1.11.1/Changes.rst --- old/argcomplete-1.10.0/Changes.rst 2019-05-12 19:26:38.000000000 +0200 +++ new/argcomplete-1.11.1/Changes.rst 2020-01-14 18:19:23.000000000 +0100 @@ -1,3 +1,39 @@ +Changes for v1.11.1 (2020-01-14) +================================ + +- Add -o bashdefault to register-python-argcomplete’s output command + (#284) + +Changes for v1.11.0 (2019-12-23) +================================ + +- Use shell builtins where possible (#280) + +- Switch from pkg_resources to importlib (#283) + +- Remove .sh extension by bash-completion convention (#281) + +- Catch exceptions in \_check_module (#269) + +- Documentation and test improvements + +Changes for v1.10.3 (2019-11-26) +================================ + +- Do not suggest options after – (end-of-options delimiter) + +Changes for v1.10.2 (2019-11-17) +================================ + +- Include all test directory contents in source distribution + +Changes for v1.10.1 (2019-11-16) +================================ + +- Trigger completers on –optional=PARTIAL_VALUE + +- Complete console scripts installed from wheels (#241) + Changes for v1.10.0 (2019-05-12) ================================ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-1.10.0/MANIFEST.in new/argcomplete-1.11.1/MANIFEST.in --- old/argcomplete-1.10.0/MANIFEST.in 2017-03-15 23:47:27.000000000 +0100 +++ new/argcomplete-1.11.1/MANIFEST.in 2019-11-17 15:24:26.000000000 +0100 @@ -1,3 +1,3 @@ include argcomplete/bash_completion.d/* include *.rst -include test/* +recursive-include test * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-1.10.0/PKG-INFO new/argcomplete-1.11.1/PKG-INFO --- old/argcomplete-1.10.0/PKG-INFO 2019-05-12 19:26:48.000000000 +0200 +++ new/argcomplete-1.11.1/PKG-INFO 2020-01-14 18:19:36.000000000 +0100 @@ -1,11 +1,14 @@ Metadata-Version: 2.1 Name: argcomplete -Version: 1.10.0 +Version: 1.11.1 Summary: Bash tab completion for argparse Home-page: https://github.com/kislyuk/argcomplete Author: Andrey Kislyuk Author-email: [email protected] License: Apache Software License +Project-URL: Documentation, https://kislyuk.github.io/argcomplete +Project-URL: Source Code, https://github.com/kislyuk/argcomplete +Project-URL: Issue Tracker, https://github.com/kislyuk/argcomplete/issues Description: argcomplete - Bash tab completion for argparse ============================================== *Tab complete all the things!* @@ -14,7 +17,7 @@ It makes two assumptions: - * You're using bash as your shell (limited support for zsh and tcsh is available) + * You're using bash as your shell (limited support for zsh, fish, and tcsh is available) * You're using `argparse <http://docs.python.org/3/library/argparse.html>`_ to manage your command line arguments/options Argcomplete is particularly useful if your program has lots of options or subparsers, and if your program can @@ -180,8 +183,7 @@ import IPython parser.add_argument("--python-name").completer = IPython.core.completer.Completer() - You can also use `argcomplete.CompletionFinder.rl_complete <https://argcomplete.readthedocs.org/en/latest/#argcomplete.CompletionFinder.rl_complete>`_ - to plug your entire argparse parser as a readline completer. + ``argcomplete.CompletionFinder.rl_complete`` can also be used to plug in an argparse parser as a readline completer. Printing warnings in completers ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -244,7 +246,7 @@ Activating global completion ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The script ``activate-global-python-argcomplete`` will try to install the file - ``bash_completion.d/python-argcomplete.sh`` (`see on GitHub`_) into an appropriate location on your system + ``bash_completion.d/python-argcomplete`` (`see on GitHub`_) into an appropriate location on your system (``/etc/bash_completion.d/`` or ``~/.bash_completion.d/``). If it fails, but you know the correct location of your bash completion scripts directory, you can specify it with ``--dest``:: @@ -256,7 +258,7 @@ The file's contents should then be sourced in e.g. ``~/.bashrc``. - .. _`see on GitHub`: https://github.com/kislyuk/argcomplete/blob/master/argcomplete/bash_completion.d/python-argcomplete.sh + .. _`see on GitHub`: https://github.com/kislyuk/argcomplete/blob/master/argcomplete/bash_completion.d/python-argcomplete Zsh Support ------------ @@ -293,7 +295,7 @@ Python Support -------------- - Argcomplete requires Python 2.7 or 3.3+. + Argcomplete requires Python 2.7 or 3.5+. Common Problems --------------- @@ -321,7 +323,7 @@ Links ----- * `Project home page (GitHub) <https://github.com/kislyuk/argcomplete>`_ - * `Documentation (Read the Docs) <https://argcomplete.readthedocs.io/en/latest/>`_ + * `Documentation <https://kislyuk.github.io/argcomplete/>`_ * `Package distribution (PyPI) <https://pypi.python.org/pypi/argcomplete>`_ * `Change log <https://github.com/kislyuk/argcomplete/blob/master/Changes.rst>`_ @@ -341,8 +343,6 @@ :target: https://pypi.python.org/pypi/argcomplete .. image:: https://img.shields.io/pypi/l/argcomplete.svg :target: https://pypi.python.org/pypi/argcomplete - .. image:: https://readthedocs.org/projects/argcomplete/badge/?version=latest - :target: https://argcomplete.readthedocs.org/ Platform: MacOS X Platform: Posix @@ -355,10 +355,10 @@ Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.3 -Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Development Status :: 5 - Production/Stable diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-1.10.0/README.rst new/argcomplete-1.11.1/README.rst --- old/argcomplete-1.10.0/README.rst 2019-05-12 19:16:02.000000000 +0200 +++ new/argcomplete-1.11.1/README.rst 2019-12-22 22:07:12.000000000 +0100 @@ -6,7 +6,7 @@ It makes two assumptions: -* You're using bash as your shell (limited support for zsh and tcsh is available) +* You're using bash as your shell (limited support for zsh, fish, and tcsh is available) * You're using `argparse <http://docs.python.org/3/library/argparse.html>`_ to manage your command line arguments/options Argcomplete is particularly useful if your program has lots of options or subparsers, and if your program can @@ -172,8 +172,7 @@ import IPython parser.add_argument("--python-name").completer = IPython.core.completer.Completer() -You can also use `argcomplete.CompletionFinder.rl_complete <https://argcomplete.readthedocs.org/en/latest/#argcomplete.CompletionFinder.rl_complete>`_ -to plug your entire argparse parser as a readline completer. +``argcomplete.CompletionFinder.rl_complete`` can also be used to plug in an argparse parser as a readline completer. Printing warnings in completers ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -236,7 +235,7 @@ Activating global completion ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The script ``activate-global-python-argcomplete`` will try to install the file -``bash_completion.d/python-argcomplete.sh`` (`see on GitHub`_) into an appropriate location on your system +``bash_completion.d/python-argcomplete`` (`see on GitHub`_) into an appropriate location on your system (``/etc/bash_completion.d/`` or ``~/.bash_completion.d/``). If it fails, but you know the correct location of your bash completion scripts directory, you can specify it with ``--dest``:: @@ -248,7 +247,7 @@ The file's contents should then be sourced in e.g. ``~/.bashrc``. -.. _`see on GitHub`: https://github.com/kislyuk/argcomplete/blob/master/argcomplete/bash_completion.d/python-argcomplete.sh +.. _`see on GitHub`: https://github.com/kislyuk/argcomplete/blob/master/argcomplete/bash_completion.d/python-argcomplete Zsh Support ------------ @@ -285,7 +284,7 @@ Python Support -------------- -Argcomplete requires Python 2.7 or 3.3+. +Argcomplete requires Python 2.7 or 3.5+. Common Problems --------------- @@ -313,7 +312,7 @@ Links ----- * `Project home page (GitHub) <https://github.com/kislyuk/argcomplete>`_ -* `Documentation (Read the Docs) <https://argcomplete.readthedocs.io/en/latest/>`_ +* `Documentation <https://kislyuk.github.io/argcomplete/>`_ * `Package distribution (PyPI) <https://pypi.python.org/pypi/argcomplete>`_ * `Change log <https://github.com/kislyuk/argcomplete/blob/master/Changes.rst>`_ @@ -333,5 +332,3 @@ :target: https://pypi.python.org/pypi/argcomplete .. image:: https://img.shields.io/pypi/l/argcomplete.svg :target: https://pypi.python.org/pypi/argcomplete -.. image:: https://readthedocs.org/projects/argcomplete/badge/?version=latest - :target: https://argcomplete.readthedocs.org/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-1.10.0/argcomplete/__init__.py new/argcomplete-1.11.1/argcomplete/__init__.py --- old/argcomplete-1.10.0/argcomplete/__init__.py 2019-05-12 19:16:02.000000000 +0200 +++ new/argcomplete-1.11.1/argcomplete/__init__.py 2019-12-28 17:07:40.000000000 +0100 @@ -1,4 +1,4 @@ -# Copyright 2012-2017, Andrey Kislyuk and argcomplete contributors. +# Copyright 2012-2019, Andrey Kislyuk and argcomplete contributors. # Licensed under the Apache License. See https://github.com/kislyuk/argcomplete for more info. from __future__ import absolute_import, division, print_function, unicode_literals @@ -8,7 +8,7 @@ from .compat import USING_PYTHON2, str, sys_encoding, ensure_str, ensure_bytes from .completers import FilesCompleter, SuppressCompleter from .my_argparse import IntrospectiveArgumentParser, action_is_satisfied, action_is_open, action_is_greedy -from .shellintegration import shellcode +from .shell_integration import shellcode _DEBUG = "_ARC_DEBUG" in os.environ @@ -213,6 +213,10 @@ start = int(os.environ["_ARGCOMPLETE"]) - 1 comp_words = comp_words[start:] + if cword_prefix and cword_prefix[0] in self._parser.prefix_chars and "=" in cword_prefix: + # Special case for when the current word is "--optional=PARTIAL_VALUE". Give the optional to the parser. + comp_words.append(cword_prefix.split("=", 1)[0]) + debug("\nLINE: {!r}".format(comp_line), "\nPOINT: {!r}".format(comp_point), "\nPREQUOTE: {!r}".format(cword_prequote), @@ -248,7 +252,8 @@ self.completing = False - # key: complete word, value: description. + if "--" in comp_words: + self.always_complete_options = False completions = self.collect_completions(active_parsers, parsed_args, cword_prefix, debug) completions = self.filter_completions(completions) @@ -377,6 +382,7 @@ debug("Active actions (L={l}): {a}".format(l=len(parser.active_actions), a=parser.active_actions)) isoptional = cword_prefix and cword_prefix[0] in parser.prefix_chars + optional_prefix = "" greedy_actions = [x for x in parser.active_actions if action_is_greedy(x, isoptional)] if greedy_actions: assert len(greedy_actions) == 1, "expect at most 1 greedy action" @@ -386,8 +392,14 @@ self._display_completions = {} completions = [] elif isoptional: - # Only run completers if current word does not start with - (is not an optional) - return completions + if "=" in cword_prefix: + # Special case for when the current word is "--optional=PARTIAL_VALUE". + # The completer runs on PARTIAL_VALUE. The prefix is added back to the completions + # (and chopped back off later in quote_completions() by the COMP_WORDBREAKS logic). + optional_prefix, _, cword_prefix = cword_prefix.partition("=") + else: + # Only run completers if current word does not start with - (is not an optional) + return completions complete_remaining_positionals = False # Use the single greedy action (if there is one) or all active actions. @@ -438,6 +450,8 @@ if self.validator(next_completion, cword_prefix): self._display_completions.update({next_completion: ""}) completions.append(next_completion) + if optional_prefix: + completions = [optional_prefix + "=" + completion for completion in completions] debug("Completions:", completions) return completions diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-1.10.0/argcomplete/_check_console_script.py new/argcomplete-1.11.1/argcomplete/_check_console_script.py --- old/argcomplete-1.10.0/argcomplete/_check_console_script.py 1970-01-01 01:00:00.000000000 +0100 +++ new/argcomplete-1.11.1/argcomplete/_check_console_script.py 2019-12-22 21:46:07.000000000 +0100 @@ -0,0 +1,57 @@ +""" +Utility for locating the module (or package's __init__.py) +associated with a given console_script name +and verifying it contains the PYTHON_ARGCOMPLETE_OK marker. + +Such scripts are automatically generated and cannot contain +the marker themselves, so we defer to the containing module or package. + +For more information on setuptools console_scripts, see +https://setuptools.readthedocs.io/en/latest/setuptools.html#automatic-script-creation + +Intended to be invoked by argcomplete's global completion function. +""" +import os +import sys + +try: + from importlib.metadata import entry_points as importlib_entry_points +except ImportError: + from importlib_metadata import entry_points as importlib_entry_points + +from ._check_module import ArgcompleteMarkerNotFound, find + + +def main(): + # Argument is the full path to the console script. + script_path = sys.argv[1] + + # Find the module and function names that correspond to this + # assuming it is actually a console script. + name = os.path.basename(script_path) + entry_points = [ep for ep in importlib_entry_points()["console_scripts"] if ep.name == name] + if not entry_points: + raise ArgcompleteMarkerNotFound('no entry point found matching script') + entry_point = entry_points[0] + module_name, function_name = entry_point.value.split(":", 1) + + # Check this looks like the script we really expected. + with open(script_path) as f: + script = f.read() + if 'from {} import {}'.format(module_name, function_name) not in script: + raise ArgcompleteMarkerNotFound('does not appear to be a console script') + if 'sys.exit({}())'.format(function_name) not in script: + raise ArgcompleteMarkerNotFound('does not appear to be a console script') + + # Look for the argcomplete marker in the script it imports. + with open(find(module_name, return_package=True)) as f: + head = f.read(1024) + if 'PYTHON_ARGCOMPLETE_OK' not in head: + raise ArgcompleteMarkerNotFound('marker not found') + + +if __name__ == '__main__': + try: + main() + except ArgcompleteMarkerNotFound as e: + sys.exit(e) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-1.10.0/argcomplete/_check_module.py new/argcomplete-1.11.1/argcomplete/_check_module.py --- old/argcomplete-1.10.0/argcomplete/_check_module.py 2019-04-02 15:57:32.000000000 +0200 +++ new/argcomplete-1.11.1/argcomplete/_check_module.py 2019-12-22 21:46:07.000000000 +0100 @@ -1,5 +1,14 @@ +""" +Utility for locating a module (or package's __main__.py) with a given name +and verifying it contains the PYTHON_ARGCOMPLETE_OK marker. + +The module name should be specified in a form usable with `python -m`. + +Intended to be invoked by argcomplete's global completion function. +""" import os import sys +import tokenize try: from importlib.util import find_spec @@ -27,7 +36,7 @@ pass -def find(name): +def find(name, return_package=False): names = name.split('.') spec = find_spec(names[0]) if spec is None: @@ -44,14 +53,34 @@ raise ArgcompleteMarkerNotFound('expecting one search location') path = os.path.join(spec.submodule_search_locations[0], *names[1:]) if os.path.isdir(path): - return os.path.join(path, '__main__.py') + filename = '__main__.py' + if return_package: + filename = '__init__.py' + return os.path.join(path, filename) else: return path + '.py' def main(): - with open(find(sys.argv[1])) as f: - head = f.read(1024) + try: + name = sys.argv[1] + except IndexError: + raise ArgcompleteMarkerNotFound('missing argument on the command line') + + filename = find(name) + if hasattr(tokenize, 'open'): + open_func = tokenize.open + else: + open_func = open + + try: + fp = open_func(filename) + except OSError: + raise ArgcompleteMarkerNotFound('cannot open file') + + with fp: + head = fp.read(1024) + if 'PYTHON_ARGCOMPLETE_OK' not in head: raise ArgcompleteMarkerNotFound('marker not found') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-1.10.0/argcomplete/bash_completion.d/python-argcomplete new/argcomplete-1.11.1/argcomplete/bash_completion.d/python-argcomplete --- old/argcomplete-1.10.0/argcomplete/bash_completion.d/python-argcomplete 1970-01-01 01:00:00.000000000 +0100 +++ new/argcomplete-1.11.1/argcomplete/bash_completion.d/python-argcomplete 2019-12-22 21:59:57.000000000 +0100 @@ -0,0 +1,92 @@ +# Copyright 2012-2019, Andrey Kislyuk and argcomplete contributors. +# Licensed under the Apache License. See https://github.com/kislyuk/argcomplete for more info. + +# Copy of __expand_tilde_by_ref from bash-completion +__python_argcomplete_expand_tilde_by_ref () { + if [ "${!1:0:1}" = "~" ]; then + if [ "${!1}" != "${!1//\/}" ]; then + eval $1="${!1/%\/*}"/'${!1#*/}'; + else + eval $1="${!1}"; + fi; + fi +} + +# Run something, muting output or redirecting it to the debug stream +# depending on the value of _ARC_DEBUG. +__python_argcomplete_run() { + if [[ -z "$_ARC_DEBUG" ]]; then + "$@" 8>&1 9>&2 1>/dev/null 2>&1 + else + "$@" 8>&1 9>&2 1>&9 2>&1 + fi +} + +# Scan the beginning of an executable file ($1) for a regexp ($2). By default, +# scan for the magic string indicating that the executable supports the +# argcomplete completion protocol. By default, scan the first kilobyte; +# if $3 is set to -n, scan until the first line break up to a kilobyte. +__python_argcomplete_scan_head() { + read -s -r ${3:--N} 1024 < "$1" + [[ "$REPLY" =~ ${2:-PYTHON_ARGCOMPLETE_OK} ]] +} + +__python_argcomplete_scan_head_noerr() { + __python_argcomplete_scan_head "$@" 2>/dev/null +} + +_python_argcomplete_global() { + local executable=$1 + __python_argcomplete_expand_tilde_by_ref executable + + local ARGCOMPLETE=0 + if [[ "$executable" == python* ]] || [[ "$executable" == pypy* ]]; then + if [[ "${COMP_WORDS[1]}" == -m ]]; then + if __python_argcomplete_run "$executable" -m argcomplete._check_module "${COMP_WORDS[2]}"; then + ARGCOMPLETE=3 + else + return + fi + elif [[ -f "${COMP_WORDS[1]}" ]] && __python_argcomplete_scan_head_noerr "${COMP_WORDS[1]}"; then + local ARGCOMPLETE=2 + else + return + fi + elif type -P "$executable" >/dev/null 2>&1; then + local SCRIPT_NAME=$(type -P "$executable") + if (type -t pyenv && [[ "$SCRIPT_NAME" = $(pyenv root)/shims/* ]]) >/dev/null 2>&1; then + local SCRIPT_NAME=$(pyenv which "$executable") + fi + if __python_argcomplete_scan_head_noerr "$SCRIPT_NAME"; then + local ARGCOMPLETE=1 + elif __python_argcomplete_scan_head_noerr "$SCRIPT_NAME" '^#!(.*)$' -n && [[ "${BASH_REMATCH[1]}" =~ ^.*(python|pypy)[0-9\.]*$ ]]; then + local interpreter="$BASH_REMATCH" + if (__python_argcomplete_scan_head_noerr "$SCRIPT_NAME" "(PBR Generated)|(EASY-INSTALL-(SCRIPT|ENTRY-SCRIPT|DEV-SCRIPT))" \ + && "$interpreter" "$(type -P python-argcomplete-check-easy-install-script)" "$SCRIPT_NAME") >/dev/null 2>&1; then + local ARGCOMPLETE=1 + elif __python_argcomplete_run "$interpreter" -m argcomplete._check_console_script "$SCRIPT_NAME"; then + local ARGCOMPLETE=1 + fi + fi + fi + + if [[ $ARGCOMPLETE != 0 ]]; then + local IFS=$(echo -e '\v') + COMPREPLY=( $(_ARGCOMPLETE_IFS="$IFS" \ + COMP_LINE="$COMP_LINE" \ + COMP_POINT="$COMP_POINT" \ + COMP_TYPE="$COMP_TYPE" \ + _ARGCOMPLETE_COMP_WORDBREAKS="$COMP_WORDBREAKS" \ + _ARGCOMPLETE=$ARGCOMPLETE \ + _ARGCOMPLETE_SUPPRESS_SPACE=1 \ + __python_argcomplete_run "$executable" "${COMP_WORDS[@]:1:ARGCOMPLETE-1}") ) + if [[ $? != 0 ]]; then + unset COMPREPLY + elif [[ "$COMPREPLY" =~ [=/:]$ ]]; then + compopt -o nospace + fi + else + type -t _completion_loader | grep -q 'function' && _completion_loader "$@" + fi +} +complete -o default -o bashdefault -D -F _python_argcomplete_global diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-1.10.0/argcomplete/bash_completion.d/python-argcomplete.sh new/argcomplete-1.11.1/argcomplete/bash_completion.d/python-argcomplete.sh --- old/argcomplete-1.10.0/argcomplete/bash_completion.d/python-argcomplete.sh 2018-01-15 01:45:40.000000000 +0100 +++ new/argcomplete-1.11.1/argcomplete/bash_completion.d/python-argcomplete.sh 1970-01-01 01:00:00.000000000 +0100 @@ -1,75 +0,0 @@ -# Copyright 2012-2013, Andrey Kislyuk and argcomplete contributors. -# Licensed under the Apache License. See https://github.com/kislyuk/argcomplete for more info. - -# Copy of __expand_tilde_by_ref from bash-completion -__python_argcomplete_expand_tilde_by_ref () { - if [ "${!1:0:1}" = "~" ]; then - if [ "${!1}" != "${!1//\/}" ]; then - eval $1="${!1/%\/*}"/'${!1#*/}'; - else - eval $1="${!1}"; - fi; - fi -} - -# Run something, muting output or redirecting it to the debug stream -# depending on the value of _ARC_DEBUG. -__python_argcomplete_run() { - if [[ -z "$_ARC_DEBUG" ]]; then - "$@" 8>&1 9>&2 1>/dev/null 2>&1 - else - "$@" 8>&1 9>&2 1>&9 2>&1 - fi -} - -_python_argcomplete_global() { - local executable=$1 - __python_argcomplete_expand_tilde_by_ref executable - - local ARGCOMPLETE=0 - if [[ "$executable" == python* ]] || [[ "$executable" == pypy* ]]; then - if [[ "${COMP_WORDS[1]}" == -m ]]; then - if "$executable" -m argcomplete._check_module "${COMP_WORDS[2]}" >/dev/null 2>&1; then - ARGCOMPLETE=3 - else - return - fi - elif [[ -f "${COMP_WORDS[1]}" ]] && (head -c 1024 "${COMP_WORDS[1]}" | grep --quiet "PYTHON_ARGCOMPLETE_OK") >/dev/null 2>&1; then - local ARGCOMPLETE=2 - else - return - fi - elif which "$executable" >/dev/null 2>&1; then - local SCRIPT_NAME=$(which "$executable") - if (type -t pyenv && [[ "$SCRIPT_NAME" = $(pyenv root)/shims/* ]]) >/dev/null 2>&1; then - local SCRIPT_NAME=$(pyenv which "$executable") - fi - if (head -c 1024 "$SCRIPT_NAME" | grep --quiet "PYTHON_ARGCOMPLETE_OK") >/dev/null 2>&1; then - local ARGCOMPLETE=1 - elif (head -c 1024 "$SCRIPT_NAME" | egrep --quiet "(PBR Generated)|(EASY-INSTALL-(SCRIPT|ENTRY-SCRIPT|DEV-SCRIPT))" \ - && [[ "$(head -n 1 "$SCRIPT_NAME")" =~ ^#!(.*)$ ]] && [[ "${BASH_REMATCH[1]}" =~ ^.*(python|pypy)[0-9\.]*$ ]] \ - && "$BASH_REMATCH" "$(which python-argcomplete-check-easy-install-script)" "$SCRIPT_NAME") >/dev/null 2>&1; then - local ARGCOMPLETE=1 - fi - fi - - if [[ $ARGCOMPLETE != 0 ]]; then - local IFS=$(echo -e '\v') - COMPREPLY=( $(_ARGCOMPLETE_IFS="$IFS" \ - COMP_LINE="$COMP_LINE" \ - COMP_POINT="$COMP_POINT" \ - COMP_TYPE="$COMP_TYPE" \ - _ARGCOMPLETE_COMP_WORDBREAKS="$COMP_WORDBREAKS" \ - _ARGCOMPLETE=$ARGCOMPLETE \ - _ARGCOMPLETE_SUPPRESS_SPACE=1 \ - __python_argcomplete_run "$executable" "${COMP_WORDS[@]:1:ARGCOMPLETE-1}") ) - if [[ $? != 0 ]]; then - unset COMPREPLY - elif [[ "$COMPREPLY" =~ [=/:]$ ]]; then - compopt -o nospace - fi - else - type -t _completion_loader | grep -q 'function' && _completion_loader "$@" - fi -} -complete -o default -o bashdefault -D -F _python_argcomplete_global diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-1.10.0/argcomplete/completers.py new/argcomplete-1.11.1/argcomplete/completers.py --- old/argcomplete-1.10.0/argcomplete/completers.py 2017-08-23 19:29:25.000000000 +0200 +++ new/argcomplete-1.11.1/argcomplete/completers.py 2019-12-22 21:58:54.000000000 +0100 @@ -1,4 +1,4 @@ -# Copyright 2012-2013, Andrey Kislyuk and argcomplete contributors. +# Copyright 2012-2019, Andrey Kislyuk and argcomplete contributors. # Licensed under the Apache License. See https://github.com/kislyuk/argcomplete for more info. from __future__ import absolute_import, division, print_function, unicode_literals diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-1.10.0/argcomplete/my_argparse.py new/argcomplete-1.11.1/argcomplete/my_argparse.py --- old/argcomplete-1.10.0/argcomplete/my_argparse.py 2017-03-15 23:47:27.000000000 +0100 +++ new/argcomplete-1.11.1/argcomplete/my_argparse.py 2019-12-22 21:58:58.000000000 +0100 @@ -1,4 +1,4 @@ -# Copyright 2012-2013, Andrey Kislyuk and argcomplete contributors. +# Copyright 2012-2019, Andrey Kislyuk and argcomplete contributors. # Licensed under the Apache License. See https://github.com/kislyuk/argcomplete for more info. from argparse import ArgumentParser, ArgumentError, SUPPRESS, _SubParsersAction diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-1.10.0/argcomplete/shell_integration.py new/argcomplete-1.11.1/argcomplete/shell_integration.py --- old/argcomplete-1.10.0/argcomplete/shell_integration.py 1970-01-01 01:00:00.000000000 +0100 +++ new/argcomplete-1.11.1/argcomplete/shell_integration.py 2020-01-14 17:20:59.000000000 +0100 @@ -0,0 +1,94 @@ +#!/usr/bin/env python + +try: + from shlex import quote +except ImportError: + from pipes import quote + +bashcode = r''' +# Run something, muting output or redirecting it to the debug stream +# depending on the value of _ARC_DEBUG. +__python_argcomplete_run() { + if [[ -z "$_ARC_DEBUG" ]]; then + "$@" 8>&1 9>&2 1>/dev/null 2>&1 + else + "$@" 8>&1 9>&2 1>&9 2>&1 + fi +} + +_python_argcomplete() { + local IFS=$'\013' + local SUPPRESS_SPACE=0 + if compopt +o nospace 2> /dev/null; then + SUPPRESS_SPACE=1 + fi + COMPREPLY=( $(IFS="$IFS" \ + COMP_LINE="$COMP_LINE" \ + COMP_POINT="$COMP_POINT" \ + COMP_TYPE="$COMP_TYPE" \ + _ARGCOMPLETE_COMP_WORDBREAKS="$COMP_WORDBREAKS" \ + _ARGCOMPLETE=1 \ + _ARGCOMPLETE_SUPPRESS_SPACE=$SUPPRESS_SPACE \ + __python_argcomplete_run "$1") ) + if [[ $? != 0 ]]; then + unset COMPREPLY + elif [[ $SUPPRESS_SPACE == 1 ]] && [[ "$COMPREPLY" =~ [=/:]$ ]]; then + compopt -o nospace + fi +} +complete %(complete_opts)s -F _python_argcomplete %(executables)s +''' + +tcshcode = '''\ +complete "%(executable)s" 'p@*@`python-argcomplete-tcsh "%(executable)s"`@' ; +''' + +fishcode = r''' +function __fish_%(executable)s_complete + set -x _ARGCOMPLETE 1 + set -x _ARGCOMPLETE_IFS \n + set -x _ARGCOMPLETE_SUPPRESS_SPACE 1 + set -x _ARGCOMPLETE_SHELL fish + set -x COMP_LINE (commandline -p) + set -x COMP_POINT (string length (commandline -cp)) + set -x COMP_TYPE + if set -q _ARC_DEBUG + %(executable)s 8>&1 9>&2 1>/dev/null 2>&1 + else + %(executable)s 8>&1 9>&2 1>&9 2>&1 + end +end +complete -c %(executable)s -f -a '(__fish_%(executable)s_complete)' +''' + + +def shellcode(executables, use_defaults=True, shell='bash', complete_arguments=None): + ''' + Provide the shell code required to register a python executable for use with the argcomplete module. + + :param str executables: Executables to be completed (when invoked exactly with this name + :param bool use_defaults: Whether to fallback to readline's default completion when no matches are generated. + :param str shell: Name of the shell to output code for (bash or tcsh) + :param complete_arguments: Arguments to call complete with + :type complete_arguments: list(str) or None + ''' + + if complete_arguments is None: + complete_options = '-o nospace -o default -o bashdefault' if use_defaults else '-o nospace -o bashdefault' + else: + complete_options = " ".join(complete_arguments) + + if shell == 'bash': + quoted_executables = [quote(i) for i in executables] + executables_list = " ".join(quoted_executables) + code = bashcode % dict(complete_opts=complete_options, executables=executables_list) + elif shell == 'fish': + code = "" + for executable in executables: + code += fishcode % dict(executable=executable) + else: + code = "" + for executable in executables: + code += tcshcode % dict(executable=executable) + + return code diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-1.10.0/argcomplete/shellintegration.py new/argcomplete-1.11.1/argcomplete/shellintegration.py --- old/argcomplete-1.10.0/argcomplete/shellintegration.py 2019-05-12 19:16:02.000000000 +0200 +++ new/argcomplete-1.11.1/argcomplete/shellintegration.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,94 +0,0 @@ -#!/usr/bin/env python - -try: - from shlex import quote -except ImportError: - from pipes import quote - -bashcode = r''' -# Run something, muting output or redirecting it to the debug stream -# depending on the value of _ARC_DEBUG. -__python_argcomplete_run() { - if [[ -z "$_ARC_DEBUG" ]]; then - "$@" 8>&1 9>&2 1>/dev/null 2>&1 - else - "$@" 8>&1 9>&2 1>&9 2>&1 - fi -} - -_python_argcomplete() { - local IFS=$'\013' - local SUPPRESS_SPACE=0 - if compopt +o nospace 2> /dev/null; then - SUPPRESS_SPACE=1 - fi - COMPREPLY=( $(IFS="$IFS" \ - COMP_LINE="$COMP_LINE" \ - COMP_POINT="$COMP_POINT" \ - COMP_TYPE="$COMP_TYPE" \ - _ARGCOMPLETE_COMP_WORDBREAKS="$COMP_WORDBREAKS" \ - _ARGCOMPLETE=1 \ - _ARGCOMPLETE_SUPPRESS_SPACE=$SUPPRESS_SPACE \ - __python_argcomplete_run "$1") ) - if [[ $? != 0 ]]; then - unset COMPREPLY - elif [[ $SUPPRESS_SPACE == 1 ]] && [[ "$COMPREPLY" =~ [=/:]$ ]]; then - compopt -o nospace - fi -} -complete %(complete_opts)s -F _python_argcomplete %(executables)s -''' - -tcshcode = '''\ -complete "%(executable)s" 'p@*@`python-argcomplete-tcsh "%(executable)s"`@' ; -''' - -fishcode = r''' -function __fish_%(executable)s_complete - set -x _ARGCOMPLETE 1 - set -x _ARGCOMPLETE_IFS \n - set -x _ARGCOMPLETE_SUPPRESS_SPACE 1 - set -x _ARGCOMPLETE_SHELL fish - set -x COMP_LINE (commandline -p) - set -x COMP_POINT (string length (commandline -cp)) - set -x COMP_TYPE - if set -q _ARC_DEBUG - %(executable)s 8>&1 9>&2 1>/dev/null 2>&1 - else - %(executable)s 8>&1 9>&2 1>&9 2>&1 - end -end -complete -c %(executable)s -f -a '(__fish_%(executable)s_complete)' -''' - - -def shellcode(executables, use_defaults=True, shell='bash', complete_arguments=None): - ''' - Provide the shell code required to register a python executable for use with the argcomplete module. - - :param str executables: Executables to be completed (when invoked exactly with this name - :param bool use_defaults: Whether to fallback to readline's default completion when no matches are generated. - :param str shell: Name of the shell to output code for (bash or tcsh) - :param complete_arguments: Arguments to call complete with - :type complete_arguments: list(str) or None - ''' - - if complete_arguments is None: - complete_options = '-o nospace -o default' if use_defaults else '-o nospace' - else: - complete_options = " ".join(complete_arguments) - - if shell == 'bash': - quoted_executables = [quote(i) for i in executables] - executables_list = " ".join(quoted_executables) - code = bashcode % dict(complete_opts=complete_options, executables=executables_list) - elif shell == 'fish': - code = "" - for executable in executables: - code += fishcode % dict(executable=executable) - else: - code = "" - for executable in executables: - code += tcshcode % dict(executable=executable) - - return code diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-1.10.0/argcomplete.egg-info/PKG-INFO new/argcomplete-1.11.1/argcomplete.egg-info/PKG-INFO --- old/argcomplete-1.10.0/argcomplete.egg-info/PKG-INFO 2019-05-12 19:26:47.000000000 +0200 +++ new/argcomplete-1.11.1/argcomplete.egg-info/PKG-INFO 2020-01-14 18:19:36.000000000 +0100 @@ -1,11 +1,14 @@ Metadata-Version: 2.1 Name: argcomplete -Version: 1.10.0 +Version: 1.11.1 Summary: Bash tab completion for argparse Home-page: https://github.com/kislyuk/argcomplete Author: Andrey Kislyuk Author-email: [email protected] License: Apache Software License +Project-URL: Documentation, https://kislyuk.github.io/argcomplete +Project-URL: Source Code, https://github.com/kislyuk/argcomplete +Project-URL: Issue Tracker, https://github.com/kislyuk/argcomplete/issues Description: argcomplete - Bash tab completion for argparse ============================================== *Tab complete all the things!* @@ -14,7 +17,7 @@ It makes two assumptions: - * You're using bash as your shell (limited support for zsh and tcsh is available) + * You're using bash as your shell (limited support for zsh, fish, and tcsh is available) * You're using `argparse <http://docs.python.org/3/library/argparse.html>`_ to manage your command line arguments/options Argcomplete is particularly useful if your program has lots of options or subparsers, and if your program can @@ -180,8 +183,7 @@ import IPython parser.add_argument("--python-name").completer = IPython.core.completer.Completer() - You can also use `argcomplete.CompletionFinder.rl_complete <https://argcomplete.readthedocs.org/en/latest/#argcomplete.CompletionFinder.rl_complete>`_ - to plug your entire argparse parser as a readline completer. + ``argcomplete.CompletionFinder.rl_complete`` can also be used to plug in an argparse parser as a readline completer. Printing warnings in completers ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -244,7 +246,7 @@ Activating global completion ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The script ``activate-global-python-argcomplete`` will try to install the file - ``bash_completion.d/python-argcomplete.sh`` (`see on GitHub`_) into an appropriate location on your system + ``bash_completion.d/python-argcomplete`` (`see on GitHub`_) into an appropriate location on your system (``/etc/bash_completion.d/`` or ``~/.bash_completion.d/``). If it fails, but you know the correct location of your bash completion scripts directory, you can specify it with ``--dest``:: @@ -256,7 +258,7 @@ The file's contents should then be sourced in e.g. ``~/.bashrc``. - .. _`see on GitHub`: https://github.com/kislyuk/argcomplete/blob/master/argcomplete/bash_completion.d/python-argcomplete.sh + .. _`see on GitHub`: https://github.com/kislyuk/argcomplete/blob/master/argcomplete/bash_completion.d/python-argcomplete Zsh Support ------------ @@ -293,7 +295,7 @@ Python Support -------------- - Argcomplete requires Python 2.7 or 3.3+. + Argcomplete requires Python 2.7 or 3.5+. Common Problems --------------- @@ -321,7 +323,7 @@ Links ----- * `Project home page (GitHub) <https://github.com/kislyuk/argcomplete>`_ - * `Documentation (Read the Docs) <https://argcomplete.readthedocs.io/en/latest/>`_ + * `Documentation <https://kislyuk.github.io/argcomplete/>`_ * `Package distribution (PyPI) <https://pypi.python.org/pypi/argcomplete>`_ * `Change log <https://github.com/kislyuk/argcomplete/blob/master/Changes.rst>`_ @@ -341,8 +343,6 @@ :target: https://pypi.python.org/pypi/argcomplete .. image:: https://img.shields.io/pypi/l/argcomplete.svg :target: https://pypi.python.org/pypi/argcomplete - .. image:: https://readthedocs.org/projects/argcomplete/badge/?version=latest - :target: https://argcomplete.readthedocs.org/ Platform: MacOS X Platform: Posix @@ -355,10 +355,10 @@ Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.3 -Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Development Status :: 5 - Production/Stable diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-1.10.0/argcomplete.egg-info/SOURCES.txt new/argcomplete-1.11.1/argcomplete.egg-info/SOURCES.txt --- old/argcomplete-1.10.0/argcomplete.egg-info/SOURCES.txt 2019-05-12 19:26:47.000000000 +0200 +++ new/argcomplete-1.11.1/argcomplete.egg-info/SOURCES.txt 2020-01-14 18:19:36.000000000 +0100 @@ -6,23 +6,27 @@ setup.cfg setup.py argcomplete/__init__.py +argcomplete/_check_console_script.py argcomplete/_check_module.py argcomplete/compat.py argcomplete/completers.py argcomplete/my_argparse.py argcomplete/my_shlex.py -argcomplete/shellintegration.py +argcomplete/shell_integration.py argcomplete.egg-info/PKG-INFO argcomplete.egg-info/SOURCES.txt argcomplete.egg-info/dependency_links.txt argcomplete.egg-info/not-zip-safe argcomplete.egg-info/requires.txt argcomplete.egg-info/top_level.txt -argcomplete/bash_completion.d/python-argcomplete.sh +argcomplete/bash_completion.d/python-argcomplete scripts/activate-global-python-argcomplete scripts/python-argcomplete-check-easy-install-script scripts/python-argcomplete-tcsh scripts/register-python-argcomplete test/__init__.py test/prog -test/test.py \ No newline at end of file +test/test.py +test/test_package/setup.py +test/test_package/test_module.py +test/test_package/test_package/__init__.py \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-1.10.0/argcomplete.egg-info/requires.txt new/argcomplete-1.11.1/argcomplete.egg-info/requires.txt --- old/argcomplete-1.10.0/argcomplete.egg-info/requires.txt 2019-05-12 19:26:47.000000000 +0200 +++ new/argcomplete-1.11.1/argcomplete.egg-info/requires.txt 2020-01-14 18:19:36.000000000 +0100 @@ -1,4 +1,16 @@ +[:python_version == "2.7"] +importlib-metadata<2,>=0.23 + +[:python_version == "3.5"] +importlib-metadata<2,>=0.23 + +[:python_version == "3.6"] +importlib-metadata<2,>=0.23 + +[:python_version == "3.7"] +importlib-metadata<2,>=0.23 + [test] coverage flake8 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-1.10.0/scripts/activate-global-python-argcomplete new/argcomplete-1.11.1/scripts/activate-global-python-argcomplete --- old/argcomplete-1.10.0/scripts/activate-global-python-argcomplete 2017-04-17 15:33:39.000000000 +0200 +++ new/argcomplete-1.11.1/scripts/activate-global-python-argcomplete 2019-12-22 21:59:28.000000000 +0100 @@ -1,7 +1,7 @@ #!/usr/bin/env python # PYTHON_ARGCOMPLETE_OK -# Copyright 2012-2013, Andrey Kislyuk and argcomplete contributors. +# Copyright 2012-2019, Andrey Kislyuk and argcomplete contributors. # Licensed under the Apache License. See https://github.com/kislyuk/argcomplete for more info. ''' @@ -36,7 +36,7 @@ else: parser.error("Path {d} does not exist".format(d=args.dest)) -activator = os.path.join(os.path.dirname(argcomplete.__file__), 'bash_completion.d', 'python-argcomplete.sh') +activator = os.path.join(os.path.dirname(argcomplete.__file__), 'bash_completion.d', 'python-argcomplete') if args.complete_arguments is None: complete_options = '-o default -o bashdefault' if args.use_defaults else '-o bashdefault' @@ -53,7 +53,7 @@ for l in open(activator): sys.stdout.write(replaceCompleteCall(l)) else: - dest = os.path.join(args.dest, "python-argcomplete.sh") + dest = os.path.join(args.dest, "python-argcomplete") sys.stdout.write("Installing bash completion script " + dest) if not args.use_defaults: @@ -64,12 +64,13 @@ try: shutil.copy(activator, dest) - if not args.complete_arguments is None or not args.use_defaults: + if args.complete_arguments or not args.use_defaults: for l in fileinput.input(dest, inplace=True): # fileinput with inplace=True redirects stdout to the edited file sys.stdout.write(replaceCompleteCall(l)) except Exception as e: err = str(e) if args.dest == dest_opt.default: - err += "\nPlease try --user to install into a user directory, or --dest to specify the bash completion modules directory" + err += ("\nPlease try --user to install into a user directory, " + "or --dest to specify the bash completion modules directory") parser.error(err) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-1.10.0/scripts/python-argcomplete-check-easy-install-script new/argcomplete-1.11.1/scripts/python-argcomplete-check-easy-install-script --- old/argcomplete-1.10.0/scripts/python-argcomplete-check-easy-install-script 2017-03-15 23:47:27.000000000 +0100 +++ new/argcomplete-1.11.1/scripts/python-argcomplete-check-easy-install-script 2019-12-22 21:59:33.000000000 +0100 @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright 2012-2013, Andrey Kislyuk and argcomplete contributors. +# Copyright 2012-2019, Andrey Kislyuk and argcomplete contributors. # Licensed under the Apache License. See https://github.com/kislyuk/argcomplete for more info. ''' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-1.10.0/scripts/register-python-argcomplete new/argcomplete-1.11.1/scripts/register-python-argcomplete --- old/argcomplete-1.10.0/scripts/register-python-argcomplete 2019-05-12 19:16:02.000000000 +0200 +++ new/argcomplete-1.11.1/scripts/register-python-argcomplete 2019-12-22 21:59:20.000000000 +0100 @@ -1,13 +1,14 @@ #!/usr/bin/env python # PYTHON_ARGCOMPLETE_OK -# Copyright 2012-2013, Andrey Kislyuk and argcomplete contributors. +# Copyright 2012-2019, Andrey Kislyuk and argcomplete contributors. # Licensed under the Apache License. See https://github.com/kislyuk/argcomplete for more info. ''' Register a Python executable for use with the argcomplete module. -To perform the registration, source the output of this script in your bash shell (quote the output to avoid interpolation). +To perform the registration, source the output of this script in your bash shell +(quote the output to avoid interpolation). Example: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-1.10.0/setup.py new/argcomplete-1.11.1/setup.py --- old/argcomplete-1.10.0/setup.py 2019-05-12 19:26:00.000000000 +0200 +++ new/argcomplete-1.11.1/setup.py 2020-01-14 18:19:08.000000000 +0100 @@ -5,11 +5,17 @@ install_requires = [] tests_require = ["coverage", "flake8", "pexpect", "wheel"] +importlib_backport_requires = ["importlib-metadata >= 0.23, < 2"] setup( name='argcomplete', - version='1.10.0', + version='1.11.1', url='https://github.com/kislyuk/argcomplete', + project_urls={ + "Documentation": "https://kislyuk.github.io/argcomplete", + "Source Code": "https://github.com/kislyuk/argcomplete", + "Issue Tracker": "https://github.com/kislyuk/argcomplete/issues" + }, license='Apache Software License', author='Andrey Kislyuk', author_email='[email protected]', @@ -17,10 +23,16 @@ long_description=open('README.rst').read(), install_requires=install_requires, tests_require=tests_require, - extras_require={"test": tests_require}, + extras_require={ + "test": tests_require, + ':python_version == "2.7"': importlib_backport_requires, + ':python_version == "3.5"': importlib_backport_requires, + ':python_version == "3.6"': importlib_backport_requires, + ':python_version == "3.7"': importlib_backport_requires + }, packages=find_packages(exclude=['test']), scripts=glob.glob('scripts/*'), - package_data={'argcomplete': ['bash_completion.d/python-argcomplete.sh']}, + package_data={'argcomplete': ['bash_completion.d/python-argcomplete']}, zip_safe=False, include_package_data=True, platforms=['MacOS X', 'Posix'], @@ -35,10 +47,10 @@ 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.3', - 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', 'Development Status :: 5 - Production/Stable', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-1.10.0/test/test.py new/argcomplete-1.11.1/test/test.py --- old/argcomplete-1.10.0/test/test.py 2019-05-12 19:16:02.000000000 +0200 +++ new/argcomplete-1.11.1/test/test.py 2019-11-22 21:05:27.000000000 +0100 @@ -24,7 +24,7 @@ from argcomplete.compat import USING_PYTHON2, str, sys_encoding, ensure_str, ensure_bytes IFS = "\013" -COMP_WORDBREAKS = " \t\n\"'><=;&(:" +COMP_WORDBREAKS = " \t\n\"'><=;|&(:" BASH_VERSION = subprocess.check_output(['bash', '-c', 'echo $BASH_VERSION']).decode() BASH_MAJOR_VERSION = int(BASH_VERSION.split('.')[0]) @@ -107,7 +107,10 @@ ("prog --shi", ["--ship "]), ("prog --ship ", ["submarine", "speedboat"]), ("prog --ship s", ["submarine", "speedboat"]), - ("prog --ship su", ["submarine "]) + ("prog --ship su", ["submarine "]), + ("prog --ship=", ["submarine", "speedboat"]), + ("prog --ship=s", ["submarine", "speedboat"]), + ("prog --ship=su", ["submarine "]), ) for cmd, output in expected_outputs: @@ -681,6 +684,7 @@ expected_outputs = ( ("prog ", ["--get", "--set", "name1", "name2"]), ("prog --", ["--get", "--set"]), + ("prog -- ", ["name1", "name2"]), ("prog --get ", ["--get", "name1", "name2"]), ("prog --get name1 ", ["--get "]) ) @@ -1178,6 +1182,42 @@ self.sh.run_command('cd ' + os.getcwd()) self.assertEqual(self.sh.run_command('python -m package.prog basic f\t'), 'foo\r\n') + def _test_console_script(self, package=False, wheel=False): + with TempDir(prefix='test_dir_py', dir='.'): + self.sh.run_command('cd ' + os.getcwd()) + self.sh.run_command('export PATH=$PATH:./bin') + self.sh.run_command('export PYTHONPATH=.:$PYTHONPATH') + test_package = os.path.join(TEST_DIR, 'test_package') + 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' + if package: + command = 'test-package' + command += ' a\t' + self.assertEqual(self.sh.run_command(command), 'arg\r\n') + + def test_console_script_module(self): + """Test completing a console_script for a module.""" + self._test_console_script() + + def test_console_script_package(self): + """Test completing a console_script for a package.""" + self._test_console_script(package=True) + + def test_console_script_module_wheel(self): + """Test completing a console_script for a module from a wheel.""" + self._test_console_script(wheel=True) + + 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) + class TestTcsh(_TestSh, unittest.TestCase): expected_failures = [ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-1.10.0/test/test_package/setup.py new/argcomplete-1.11.1/test/test_package/setup.py --- old/argcomplete-1.10.0/test/test_package/setup.py 1970-01-01 01:00:00.000000000 +0100 +++ new/argcomplete-1.11.1/test/test_package/setup.py 2019-10-24 01:48:19.000000000 +0200 @@ -0,0 +1,15 @@ +from setuptools import setup + + +setup( + name='test-package', + version='0', + py_modules=['test_module'], + packages=['test_package'], + entry_points={ + 'console_scripts': [ + 'test-module=test_module:main', + 'test-package=test_package:main', + ] + } +) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-1.10.0/test/test_package/test_module.py new/argcomplete-1.11.1/test/test_package/test_module.py --- old/argcomplete-1.10.0/test/test_package/test_module.py 1970-01-01 01:00:00.000000000 +0100 +++ new/argcomplete-1.11.1/test/test_package/test_module.py 2019-10-24 01:48:19.000000000 +0200 @@ -0,0 +1,6 @@ +# PYTHON_ARGCOMPLETE_OK +from test_package import main + + +if __name__ == '__main__': + main() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-1.10.0/test/test_package/test_package/__init__.py new/argcomplete-1.11.1/test/test_package/test_package/__init__.py --- old/argcomplete-1.10.0/test/test_package/test_package/__init__.py 1970-01-01 01:00:00.000000000 +0100 +++ new/argcomplete-1.11.1/test/test_package/test_package/__init__.py 2019-10-24 01:48:19.000000000 +0200 @@ -0,0 +1,16 @@ +# PYTHON_ARGCOMPLETE_OK +import argparse + +import argcomplete + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('arg', choices=['arg']) + argcomplete.autocomplete(parser) + args = parser.parse_args() + print(args.arg) + + +if __name__ == '__main__': + main() ++++++ skip_tcsh_tests.patch ++++++ --- /var/tmp/diff_new_pack.7Ag8dX/_old 2020-01-17 16:07:56.220512421 +0100 +++ /var/tmp/diff_new_pack.7Ag8dX/_new 2020-01-17 16:07:56.220512421 +0100 @@ -1,9 +1,9 @@ -Index: argcomplete-1.10.0/test/test.py +Index: argcomplete-1.11.0/test/test.py =================================================================== ---- argcomplete-1.10.0.orig/test/test.py -+++ argcomplete-1.10.0/test/test.py -@@ -1179,34 +1179,6 @@ class TestBashGlobal(TestBash): - self.assertEqual(self.sh.run_command('python -m package.prog basic f\t'), 'foo\r\n') +--- argcomplete-1.11.0.orig/test/test.py ++++ argcomplete-1.11.0/test/test.py +@@ -1219,34 +1219,6 @@ class TestBashGlobal(TestBash): + self._test_console_script(package=True, wheel=True) -class TestTcsh(_TestSh, unittest.TestCase): ++++++ trim-test-deps.patch ++++++ --- /var/tmp/diff_new_pack.7Ag8dX/_old 2020-01-17 16:07:56.228512425 +0100 +++ /var/tmp/diff_new_pack.7Ag8dX/_new 2020-01-17 16:07:56.228512425 +0100 @@ -1,11 +1,13 @@ ---- argcomplete-1.9.2.orig/setup.py 2017-08-24 00:37:12.000000000 +0700 -+++ argcomplete-1.9.2/setup.py 2019-02-10 21:22:50.518878293 +0700 -@@ -4,7 +4,7 @@ +Index: argcomplete-1.11.0/setup.py +=================================================================== +--- argcomplete-1.11.0.orig/setup.py ++++ argcomplete-1.11.0/setup.py +@@ -4,7 +4,7 @@ import glob from setuptools import setup, find_packages install_requires = [] -tests_require = ["coverage", "flake8", "pexpect", "wheel"] +tests_require = ["pexpect"] + importlib_backport_requires = ["importlib-metadata >= 0.23, < 2"] setup( - name='argcomplete',
