Hello community, here is the log from the commit of package python-argcomplete for openSUSE:Factory checked in at 2019-02-25 17:57:26 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-argcomplete (Old) and /work/SRC/openSUSE:Factory/.python-argcomplete.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-argcomplete" Mon Feb 25 17:57:26 2019 rev:10 rq:678738 version:1.9.4 Changes: -------- --- /work/SRC/openSUSE:Factory/python-argcomplete/python-argcomplete.changes 2018-12-12 17:25:00.803141559 +0100 +++ /work/SRC/openSUSE:Factory/.python-argcomplete.new.28833/python-argcomplete.changes 2019-02-25 17:57:30.582282336 +0100 @@ -1,0 +2,12 @@ +Mon Feb 25 05:52:03 UTC 2019 - John Vandenberg <[email protected]> + +- Trim unnecessary build dependencies using trim-test-deps.patch +- Simplify skip_tcsh_tests.patch so it is easier to read and update +- Update to v1.9.4 + * Use the correct interpreter when checking wrappers + * Provide shellcode as a module function (#237) +- from v1.9.3 + * Fix handling of COMP\_POINT + * Fix crash when writing unicode to debug\_stream in Python 2 + +------------------------------------------------------------------- Old: ---- argcomplete-1.9.2.tar.gz New: ---- argcomplete-1.9.4.tar.gz trim-test-deps.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-argcomplete.spec ++++++ --- /var/tmp/diff_new_pack.PWXAMP/_old 2019-02-25 17:57:32.126281023 +0100 +++ /var/tmp/diff_new_pack.PWXAMP/_new 2019-02-25 17:57:32.126281023 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-argcomplete # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # Copyright (c) 2013 Darin Perusich. # # All modifications and additions to the file contributed by third parties @@ -20,7 +20,7 @@ %{!?license: %global license %doc} %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-argcomplete -Version: 1.9.2 +Version: 1.9.4 Release: 0 Summary: Bash tab completion for argparse License: Apache-2.0 @@ -28,15 +28,12 @@ Url: https://github.com/kislyuk/argcomplete 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 setuptools} BuildRequires: python-rpm-macros # SECTION tests -BuildRequires: %{python_module coverage} -BuildRequires: %{python_module flake8} BuildRequires: %{python_module pexpect} -BuildRequires: %{python_module wheel} # END SECTIONS tests -Requires: python-wheel BuildArch: noarch %python_subpackages @@ -57,6 +54,7 @@ %prep %setup -q -n argcomplete-%{version} %patch0 -p1 +%patch1 -p1 %build %python_build @@ -77,7 +75,6 @@ %python_exec setup.py test %files %{python_files} -%defattr(-,root,root) %doc README.rst %license LICENSE.rst %{python_sitelib}/argcomplete-%{version}-py%{python_version}.egg-info ++++++ argcomplete-1.9.2.tar.gz -> argcomplete-1.9.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-1.9.2/Changes.rst new/argcomplete-1.9.4/Changes.rst --- old/argcomplete-1.9.2/Changes.rst 2017-08-23 19:37:47.000000000 +0200 +++ new/argcomplete-1.9.4/Changes.rst 2018-02-13 16:40:50.000000000 +0100 @@ -1,3 +1,17 @@ +Changes for v1.9.4 (2018-02-13) +=============================== + +- Use the correct interpreter when checking wrappers (#226) + +- Provide shellcode as a module function (#237) + +Changes for v1.9.3 (2017-11-16) +=============================== + +- Fix handling of COMP\_POINT (#236) + +- Fix crash when writing unicode to debug\_stream in Python 2 (#230) + Changes for v1.9.2 (2017-08-23) =============================== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-1.9.2/PKG-INFO new/argcomplete-1.9.4/PKG-INFO --- old/argcomplete-1.9.2/PKG-INFO 2017-08-23 19:38:01.000000000 +0200 +++ new/argcomplete-1.9.4/PKG-INFO 2018-02-13 16:41:04.000000000 +0100 @@ -1,11 +1,12 @@ Metadata-Version: 1.1 Name: argcomplete -Version: 1.9.2 +Version: 1.9.4 Summary: Bash tab completion for argparse Home-page: https://github.com/kislyuk/argcomplete Author: Andrey Kislyuk Author-email: [email protected] License: Apache Software License +Description-Content-Type: UNKNOWN Description: argcomplete - Bash tab completion for argparse ============================================== *Tab complete all the things!* @@ -51,11 +52,6 @@ eval "$(register-python-argcomplete my-awesome-script)" - Note that the script name is passed directly to ``complete``, meaning it is only tab completed when invoked exactly - as it was registered. In the above example, ``my-awesome-script`` must be on the path, and the user must be - attempting to complete it by that name. The above line alone would **not** allow you to complete ``./my-awesome-script``, - or ``/path/to/my-awesome-script``. If you need this, you must register them separately, or use global completion. - argcomplete.autocomplete(*parser*) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This method is the entry point to the module. It must be called **after** ArgumentParser construction is complete, but @@ -238,6 +234,14 @@ argcomplete will follow the wrapper scripts to their destination and look for ``PYTHON_ARGCOMPLETE_OK`` in the destination code. + If you choose not to use global completion, or ship a bash completion module that depends on argcomplete, you must + register your script explicitly using ``eval "$(register-python-argcomplete my-awesome-script)"``. Standard bash + completion registration roules apply: namely, the script name is passed directly to ``complete``, meaning it is only tab + completed when invoked exactly as it was registered. In the above example, ``my-awesome-script`` must be on the path, + and the user must be attempting to complete it by that name. The above line alone would **not** allow you to complete + ``./my-awesome-script``, or ``/path/to/my-awesome-script``. + + Activating global completion ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The script ``activate-global-python-argcomplete`` will try to install the file @@ -284,15 +288,9 @@ Debugging --------- - Set the ``_ARC_DEBUG`` variable in your shell to enable verbose debug output every time argcomplete runs. Alternatively, - you can bypass the bash completion shellcode altogether, and interact with the Python code directly with something like - this:: - - PROGNAME=./{YOUR_PY_SCRIPT} TEST_ARGS='some_arguments with autocompl' _ARC_DEBUG=1 COMP_LINE="$PROGNAME $TEST_ARGS" COMP_POINT=31 _ARGCOMPLETE=1 $PROGNAME 8>&1 9>>~/autocomplete_debug.log - - Then tail:: - - tail -f ~/autocomplete_debug.log + Set the ``_ARC_DEBUG`` variable in your shell to enable verbose debug output every time argcomplete runs. This will + disrupt the command line composition state of your terminal, but make it possible to see the internal state of the + completer if it encounters problems. Acknowledgments --------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-1.9.2/README.rst new/argcomplete-1.9.4/README.rst --- old/argcomplete-1.9.2/README.rst 2017-07-13 23:06:11.000000000 +0200 +++ new/argcomplete-1.9.4/README.rst 2018-01-15 01:59:16.000000000 +0100 @@ -43,11 +43,6 @@ eval "$(register-python-argcomplete my-awesome-script)" -Note that the script name is passed directly to ``complete``, meaning it is only tab completed when invoked exactly -as it was registered. In the above example, ``my-awesome-script`` must be on the path, and the user must be -attempting to complete it by that name. The above line alone would **not** allow you to complete ``./my-awesome-script``, -or ``/path/to/my-awesome-script``. If you need this, you must register them separately, or use global completion. - argcomplete.autocomplete(*parser*) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This method is the entry point to the module. It must be called **after** ArgumentParser construction is complete, but @@ -230,6 +225,14 @@ argcomplete will follow the wrapper scripts to their destination and look for ``PYTHON_ARGCOMPLETE_OK`` in the destination code. +If you choose not to use global completion, or ship a bash completion module that depends on argcomplete, you must +register your script explicitly using ``eval "$(register-python-argcomplete my-awesome-script)"``. Standard bash +completion registration roules apply: namely, the script name is passed directly to ``complete``, meaning it is only tab +completed when invoked exactly as it was registered. In the above example, ``my-awesome-script`` must be on the path, +and the user must be attempting to complete it by that name. The above line alone would **not** allow you to complete +``./my-awesome-script``, or ``/path/to/my-awesome-script``. + + Activating global completion ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The script ``activate-global-python-argcomplete`` will try to install the file @@ -276,15 +279,9 @@ Debugging --------- -Set the ``_ARC_DEBUG`` variable in your shell to enable verbose debug output every time argcomplete runs. Alternatively, -you can bypass the bash completion shellcode altogether, and interact with the Python code directly with something like -this:: - - PROGNAME=./{YOUR_PY_SCRIPT} TEST_ARGS='some_arguments with autocompl' _ARC_DEBUG=1 COMP_LINE="$PROGNAME $TEST_ARGS" COMP_POINT=31 _ARGCOMPLETE=1 $PROGNAME 8>&1 9>>~/autocomplete_debug.log - -Then tail:: - - tail -f ~/autocomplete_debug.log +Set the ``_ARC_DEBUG`` variable in your shell to enable verbose debug output every time argcomplete runs. This will +disrupt the command line composition state of your terminal, but make it possible to see the internal state of the +completer if it encounters problems. Acknowledgments --------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-1.9.2/argcomplete/__init__.py new/argcomplete-1.9.4/argcomplete/__init__.py --- old/argcomplete-1.9.2/argcomplete/__init__.py 2017-08-23 19:29:25.000000000 +0200 +++ new/argcomplete-1.9.4/argcomplete/__init__.py 2017-11-21 17:06:21.000000000 +0100 @@ -1,4 +1,4 @@ -# Copyright 2012-2015, Andrey Kislyuk and argcomplete contributors. +# Copyright 2012-2017, 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,6 +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 # noqa _DEBUG = "_ARC_DEBUG" in os.environ @@ -15,6 +16,11 @@ def debug(*args): if _DEBUG: + if USING_PYTHON2: + # debug_stream has to be binary mode in Python 2. + # Attempting to write unicode directly uses the default ascii conversion. + # Convert any unicode to bytes, leaving non-string input alone. + args = [ensure_bytes(x) if isinstance(x, str) else x for x in args] print(file=debug_stream, *args) BASH_FILE_COMPLETION_FALLBACK = 79 @@ -194,12 +200,6 @@ comp_line = os.environ["COMP_LINE"] comp_point = int(os.environ["COMP_POINT"]) - # Adjust comp_point for wide chars - if USING_PYTHON2: - comp_point = len(comp_line[:comp_point].decode(sys_encoding)) - else: - comp_point = len(comp_line.encode(sys_encoding)[:comp_point].decode(sys_encoding)) - comp_line = ensure_str(comp_line) cword_prequote, cword_prefix, cword_suffix, comp_words, last_wordbreak_pos = split_line(comp_line, comp_point) @@ -211,8 +211,11 @@ start = int(os.environ["_ARGCOMPLETE"]) - 1 comp_words = comp_words[start:] - debug("\nLINE: '{l}'\nPREQUOTE: '{pq}'\nPREFIX: '{p}'".format(l=comp_line, pq=cword_prequote, p=cword_prefix), - "\nSUFFIX: '{s}'".format(s=cword_suffix), + debug("\nLINE: {!r}".format(comp_line), + "\nPOINT: {!r}".format(comp_point), + "\nPREQUOTE: {!r}".format(cword_prequote), + "\nPREFIX: {!r}".format(cword_prefix), + "\nSUFFIX: {!r}".format(cword_suffix), "\nWORDS:", comp_words) completions = self._get_completions(comp_words, cword_prefix, cword_prequote, last_wordbreak_pos) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-1.9.2/argcomplete/bash_completion.d/python-argcomplete.sh new/argcomplete-1.9.4/argcomplete/bash_completion.d/python-argcomplete.sh --- old/argcomplete-1.9.2/argcomplete/bash_completion.d/python-argcomplete.sh 2017-04-17 15:36:27.000000000 +0200 +++ new/argcomplete-1.9.4/argcomplete/bash_completion.d/python-argcomplete.sh 2018-01-15 01:45:40.000000000 +0100 @@ -47,7 +47,8 @@ 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))" \ - && python-argcomplete-check-easy-install-script "$SCRIPT_NAME") >/dev/null 2>&1; then + && [[ "$(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 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-1.9.2/argcomplete/shellintegration.py new/argcomplete-1.9.4/argcomplete/shellintegration.py --- old/argcomplete-1.9.2/argcomplete/shellintegration.py 1970-01-01 01:00:00.000000000 +0100 +++ new/argcomplete-1.9.4/argcomplete/shellintegration.py 2017-11-21 17:06:21.000000000 +0100 @@ -0,0 +1,62 @@ +#!/usr/bin/env python + +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 "%(executable)s" +''' + +tcshcode = '''\ +complete "%(executable)s" 'p@*@`python-argcomplete-tcsh "%(executable)s"`@' +''' + +def shellcode(executable, 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 executable: Executable 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': + code = bashcode + else: + code = tcshcode + + return code % dict(complete_opts=complete_options, executable=executable) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-1.9.2/argcomplete.egg-info/PKG-INFO new/argcomplete-1.9.4/argcomplete.egg-info/PKG-INFO --- old/argcomplete-1.9.2/argcomplete.egg-info/PKG-INFO 2017-08-23 19:38:01.000000000 +0200 +++ new/argcomplete-1.9.4/argcomplete.egg-info/PKG-INFO 2018-02-13 16:41:04.000000000 +0100 @@ -1,11 +1,12 @@ Metadata-Version: 1.1 Name: argcomplete -Version: 1.9.2 +Version: 1.9.4 Summary: Bash tab completion for argparse Home-page: https://github.com/kislyuk/argcomplete Author: Andrey Kislyuk Author-email: [email protected] License: Apache Software License +Description-Content-Type: UNKNOWN Description: argcomplete - Bash tab completion for argparse ============================================== *Tab complete all the things!* @@ -51,11 +52,6 @@ eval "$(register-python-argcomplete my-awesome-script)" - Note that the script name is passed directly to ``complete``, meaning it is only tab completed when invoked exactly - as it was registered. In the above example, ``my-awesome-script`` must be on the path, and the user must be - attempting to complete it by that name. The above line alone would **not** allow you to complete ``./my-awesome-script``, - or ``/path/to/my-awesome-script``. If you need this, you must register them separately, or use global completion. - argcomplete.autocomplete(*parser*) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This method is the entry point to the module. It must be called **after** ArgumentParser construction is complete, but @@ -238,6 +234,14 @@ argcomplete will follow the wrapper scripts to their destination and look for ``PYTHON_ARGCOMPLETE_OK`` in the destination code. + If you choose not to use global completion, or ship a bash completion module that depends on argcomplete, you must + register your script explicitly using ``eval "$(register-python-argcomplete my-awesome-script)"``. Standard bash + completion registration roules apply: namely, the script name is passed directly to ``complete``, meaning it is only tab + completed when invoked exactly as it was registered. In the above example, ``my-awesome-script`` must be on the path, + and the user must be attempting to complete it by that name. The above line alone would **not** allow you to complete + ``./my-awesome-script``, or ``/path/to/my-awesome-script``. + + Activating global completion ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The script ``activate-global-python-argcomplete`` will try to install the file @@ -284,15 +288,9 @@ Debugging --------- - Set the ``_ARC_DEBUG`` variable in your shell to enable verbose debug output every time argcomplete runs. Alternatively, - you can bypass the bash completion shellcode altogether, and interact with the Python code directly with something like - this:: - - PROGNAME=./{YOUR_PY_SCRIPT} TEST_ARGS='some_arguments with autocompl' _ARC_DEBUG=1 COMP_LINE="$PROGNAME $TEST_ARGS" COMP_POINT=31 _ARGCOMPLETE=1 $PROGNAME 8>&1 9>>~/autocomplete_debug.log - - Then tail:: - - tail -f ~/autocomplete_debug.log + Set the ``_ARC_DEBUG`` variable in your shell to enable verbose debug output every time argcomplete runs. This will + disrupt the command line composition state of your terminal, but make it possible to see the internal state of the + completer if it encounters problems. Acknowledgments --------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-1.9.2/argcomplete.egg-info/SOURCES.txt new/argcomplete-1.9.4/argcomplete.egg-info/SOURCES.txt --- old/argcomplete-1.9.2/argcomplete.egg-info/SOURCES.txt 2017-08-23 19:38:01.000000000 +0200 +++ new/argcomplete-1.9.4/argcomplete.egg-info/SOURCES.txt 2018-02-13 16:41:04.000000000 +0100 @@ -11,6 +11,7 @@ argcomplete/completers.py argcomplete/my_argparse.py argcomplete/my_shlex.py +argcomplete/shellintegration.py argcomplete.egg-info/PKG-INFO argcomplete.egg-info/SOURCES.txt argcomplete.egg-info/dependency_links.txt diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-1.9.2/scripts/register-python-argcomplete new/argcomplete-1.9.4/scripts/register-python-argcomplete --- old/argcomplete-1.9.2/scripts/register-python-argcomplete 2017-03-15 23:47:27.000000000 +0100 +++ new/argcomplete-1.9.4/scripts/register-python-argcomplete 2017-11-21 17:06:21.000000000 +0100 @@ -20,44 +20,8 @@ import sys import argparse +import argcomplete -shellcode = 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 "%(executable)s" -''' - -tcshcode = '''\ -complete "%(executable)s" 'p@*@`python-argcomplete-tcsh "%(executable)s"`@' -''' parser = argparse.ArgumentParser( description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) @@ -85,17 +49,6 @@ args = parser.parse_args() -if args.complete_arguments is None: - complete_options = '-o nospace -o default' if args.use_defaults else '-o nospace' -else: - complete_options = " ".join(args.complete_arguments) - -if args.shell == 'bash': - code = shellcode -else: - code = tcshcode - -sys.stdout.write(code % dict( - complete_opts=complete_options, - executable=args.executable -)) + +sys.stdout.write(argcomplete.shellcode( + args.executable, args.use_defaults, args.shell, args.complete_arguments)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-1.9.2/setup.cfg new/argcomplete-1.9.4/setup.cfg --- old/argcomplete-1.9.2/setup.cfg 2017-08-23 19:38:01.000000000 +0200 +++ new/argcomplete-1.9.4/setup.cfg 2018-02-13 16:41:04.000000000 +0100 @@ -10,7 +10,7 @@ [flake8] max-line-length = 120 -ignore = E301, E302, E305, E401 +ignore = E301, E302, E305, E401, E722, E741 exclude = my_shlex.py [egg_info] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-1.9.2/setup.py new/argcomplete-1.9.4/setup.py --- old/argcomplete-1.9.2/setup.py 2017-08-23 19:37:12.000000000 +0200 +++ new/argcomplete-1.9.4/setup.py 2018-02-13 16:40:23.000000000 +0100 @@ -8,7 +8,7 @@ setup( name='argcomplete', - version='1.9.2', + version='1.9.4', url='https://github.com/kislyuk/argcomplete', license='Apache Software License', author='Andrey Kislyuk', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-1.9.2/test/prog new/argcomplete-1.9.4/test/prog --- old/argcomplete-1.9.2/test/prog 2017-08-23 19:29:20.000000000 +0200 +++ new/argcomplete-1.9.4/test/prog 2017-11-16 21:46:21.000000000 +0100 @@ -25,6 +25,10 @@ return ['foo'] +def get_comp_point(*args, **kwargs): + return [os.environ['COMP_POINT']] + + parser = argparse.ArgumentParser() subparsers = parser.add_subparsers() subparsers.add_parser('basic').add_argument('arg', choices=['foo', 'bar', 'baz']) @@ -35,8 +39,17 @@ subparsers.add_parser('break').add_argument('arg', choices=['a:b:c', 'a:b:d']) subparsers.add_parser('env').add_argument('arg').completer = check_environ subparsers.add_parser('debug').add_argument('arg').completer = print_output +subparsers.add_parser('point', add_help=False).add_argument('arg', nargs='*').completer = get_comp_point -argcomplete.autocomplete(parser) +if 'POINT' in os.environ: + argcomplete.autocomplete(parser, validator=lambda x, y: True) +else: + argcomplete.autocomplete(parser) + args = parser.parse_args() -print(args.arg) + +if 'POINT' in os.environ: + print(args.arg[-1]) +else: + print(args.arg) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-1.9.2/test/test.py new/argcomplete-1.9.4/test/test.py --- old/argcomplete-1.9.2/test/test.py 2017-08-23 19:29:25.000000000 +0200 +++ new/argcomplete-1.9.4/test/test.py 2018-02-13 16:40:04.000000000 +0100 @@ -3,13 +3,13 @@ from __future__ import absolute_import, division, print_function, unicode_literals -import os, sys, shutil, argparse, subprocess, unittest +import os, sys, shutil, argparse, subprocess, unittest, io import pexpect, pexpect.replwrap -from tempfile import TemporaryFile, mkdtemp +from tempfile import TemporaryFile, NamedTemporaryFile, mkdtemp -TEST_DIR = os.path.abspath(os.path.dirname(__file__)) -BASE_DIR = os.path.dirname(TEST_DIR) -sys.path.insert(0, BASE_DIR) +TEST_DIR = os.path.abspath(os.path.dirname(__file__)) # noqa +BASE_DIR = os.path.dirname(TEST_DIR) # noqa +sys.path.insert(0, BASE_DIR) # noqa from argparse import ArgumentParser, SUPPRESS from argcomplete import ( @@ -17,7 +17,8 @@ CompletionFinder, split_line, ExclusiveCompletionFinder, - _check_module + _check_module, + shellcode ) from argcomplete.completers import FilesCompleter, DirectoriesCompleter, SuppressCompleter from argcomplete.compat import USING_PYTHON2, str, sys_encoding, ensure_str, ensure_bytes @@ -69,8 +70,7 @@ command = ensure_str(command) if point is None: - # Adjust point for wide chars - point = str(len(command.encode(sys_encoding))) + point = str(len(command)) with TemporaryFile() as t: os.environ["COMP_LINE"] = ensure_bytes(command) if USING_PYTHON2 else command os.environ["COMP_POINT"] = point @@ -738,6 +738,19 @@ self.assertEqual(set(self.run_completer(make_parser(), 'prog -3 "')), {"\"'"}) self.assertEqual(set(self.run_completer(make_parser(), "prog -3 '")), {"\"'"}) + def test_shellcode_utility(self): + with NamedTemporaryFile() as fh: + sc = shellcode("prog", use_defaults=True, shell="bash", complete_arguments=None) + fh.write(sc.encode()) + fh.flush() + subprocess.check_call(['bash', '-n', fh.name]) + with NamedTemporaryFile() as fh: + sc = shellcode("prog", use_defaults=False, shell="bash", complete_arguments=["-o", "nospace"]) + fh.write(sc.encode()) + fh.flush() + subprocess.check_call(['bash', '-n', fh.name]) + sc = shellcode("prog", use_defaults=False, shell="tcsh", complete_arguments=["-o", "nospace"]) + sc = shellcode("prog", use_defaults=False, shell="woosh", complete_arguments=["-o", "nospace"]) class TestArgcompleteREPL(unittest.TestCase): def setUp(self): @@ -1076,6 +1089,14 @@ def test_completion_environment(self): self.assertEqual(self.sh.run_command('prog env o\t'), 'ok\r\n') + def test_comp_point(self): + # Use environment variable to change how prog behaves + self.assertEqual(self.sh.run_command('export POINT=1'), '') + self.assertEqual(self.sh.run_command('prog point hi\t'), '13\r\n') + self.assertEqual(self.sh.run_command('prog point hi \t'), '14\r\n') + self.assertEqual(self.sh.run_command('prog point 你好嘚瑟\t'), '15\r\n') + self.assertEqual(self.sh.run_command('prog point 你好嘚瑟 \t'), '16\r\n') + class TestBash(_TestSh, unittest.TestCase): expected_failures = [ @@ -1156,6 +1177,8 @@ 'test_continuation', 'test_parse_special_characters', 'test_parse_special_characters_dollar', + # Test case doesn't work under tcsh, could be fixed. + 'test_comp_point', ] def setUp(self): ++++++ skip_tcsh_tests.patch ++++++ --- /var/tmp/diff_new_pack.PWXAMP/_old 2019-02-25 17:57:32.210280951 +0100 +++ /var/tmp/diff_new_pack.PWXAMP/_new 2019-02-25 17:57:32.210280951 +0100 @@ -1,7 +1,7 @@ -diff -Nru argcomplete-1.9.2.orig/test/test.py argcomplete-1.9.2/test/test.py ---- argcomplete-1.9.2.orig/test/test.py 2017-08-23 19:29:25.000000000 +0200 -+++ argcomplete-1.9.2/test/test.py 2017-09-15 11:55:27.264394475 +0200 -@@ -1149,30 +1149,30 @@ +diff -ur argcomplete-1.9.4.orig/test/test.py argcomplete-1.9.4/test/test.py +--- argcomplete-1.9.4.orig/test/test.py 2018-02-13 22:40:04.000000000 +0700 ++++ argcomplete-1.9.4/test/test.py 2019-02-10 21:45:44.370237665 +0700 +@@ -1170,34 +1170,6 @@ self.assertEqual(self.sh.run_command('python -m package.prog basic f\t'), 'foo\r\n') @@ -12,6 +12,8 @@ - 'test_continuation', - 'test_parse_special_characters', - 'test_parse_special_characters_dollar', +- # Test case doesn't work under tcsh, could be fixed. +- 'test_comp_point', - ] - - def setUp(self): @@ -29,30 +31,8 @@ - with self.assertRaises((pexpect.EOF, OSError)): - self.sh.run_command('exit') - self.sh.run_command('') -+# class TestTcsh(_TestSh, unittest.TestCase): -+# expected_failures = [ -+# 'test_unquoted_space', -+# 'test_quoted_space', -+# 'test_continuation', -+# 'test_parse_special_characters', -+# 'test_parse_special_characters_dollar', -+# ] -+ -+# def setUp(self): -+# sh = Shell('tcsh') -+# path = ' '.join([os.path.join(BASE_DIR, 'scripts'), TEST_DIR, '$path']) -+# sh.run_command('set path = ({0})'.format(path)) -+# sh.run_command('setenv PYTHONPATH {0}'.format(BASE_DIR)) -+# output = sh.run_command('eval `register-python-argcomplete --shell tcsh prog`') -+# self.assertEqual(output, '') -+# self.sh = sh -+ -+# def tearDown(self): -+# # The shell wrapper is fragile; exactly which exception is raised -+# # differs depending on environment. -+# with self.assertRaises((pexpect.EOF, OSError)): -+# self.sh.run_command('exit') -+# self.sh.run_command('') - - +- +- class Shell(object): + def __init__(self, shell): + self.child = pexpect.spawn(shell, encoding='utf-8') ++++++ trim-test-deps.patch ++++++ --- 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 @@ from setuptools import setup, find_packages install_requires = [] -tests_require = ["coverage", "flake8", "pexpect", "wheel"] +tests_require = ["pexpect"] setup( name='argcomplete',
