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 2023-07-05 15:30:46 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-argcomplete (Old) and /work/SRC/openSUSE:Factory/.python-argcomplete.new.23466 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-argcomplete" Wed Jul 5 15:30:46 2023 rev:26 rq:1096831 version:3.1.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-argcomplete/python-argcomplete.changes 2023-06-03 00:06:37.661777781 +0200 +++ /work/SRC/openSUSE:Factory/.python-argcomplete.new.23466/python-argcomplete.changes 2023-07-05 15:31:00.214724182 +0200 @@ -1,0 +2,15 @@ +Tue Jul 4 11:24:40 UTC 2023 - John Paul Adrian Glaubitz <adrian.glaub...@suse.com> + +- Update to version 3.1.1 + * Search through asdf shims + * Use \` as escape character in PowerShell (#434) +- from version 3.1.0 + * setup.py -> pyproject.toml migration start (#427) + * Improve user install logic in activate-global-python-argcomplete (#437) + * Ensure Python 3.7 compatibility in check_console_script (#436) + * ZSH implementation fixes (#431, #433) + * Documentation improvements +- Drop obsolete patch + * trim-test-deps.patch + +------------------------------------------------------------------- Old: ---- argcomplete-3.0.8.tar.gz trim-test-deps.patch New: ---- argcomplete-3.1.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-argcomplete.spec ++++++ --- /var/tmp/diff_new_pack.pyKuWW/_old 2023-07-05 15:31:00.842727908 +0200 +++ /var/tmp/diff_new_pack.pyKuWW/_new 2023-07-05 15:31:00.846727932 +0200 @@ -20,14 +20,13 @@ %global skip_python2 1 %{?sle15_python_module_pythons} Name: python-argcomplete -Version: 3.0.8 +Version: 3.1.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 -Patch1: trim-test-deps.patch # 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 @@ -95,7 +94,7 @@ %files %{python_files} %doc README.rst %license LICENSE.rst -%{python_sitelib}/argcomplete-%{version}*-info +%{python_sitelib}/argcomplete-*-info %{python_sitelib}/argcomplete %python_alternative %{_bindir}/python-argcomplete-check-easy-install-script %python_alternative %{_bindir}/register-python-argcomplete ++++++ argcomplete-3.0.8.tar.gz -> argcomplete-3.1.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-3.0.8/.github/FUNDING.yml new/argcomplete-3.1.1/.github/FUNDING.yml --- old/argcomplete-3.0.8/.github/FUNDING.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/argcomplete-3.1.1/.github/FUNDING.yml 2021-06-26 16:08:42.000000000 +0200 @@ -0,0 +1 @@ +github: [kislyuk] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-3.0.8/.github/workflows/ci.yml new/argcomplete-3.1.1/.github/workflows/ci.yml --- old/argcomplete-3.0.8/.github/workflows/ci.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/argcomplete-3.1.1/.github/workflows/ci.yml 2023-04-23 23:34:49.000000000 +0200 @@ -0,0 +1,35 @@ +name: Python package + +on: [push, pull_request] + +jobs: + build: + runs-on: ${{matrix.os}} + strategy: + fail-fast: false + matrix: + os: [ubuntu-20.04, ubuntu-22.04, macos-11, macos-12] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{matrix.python-version}} + - name: Install CI dependencies + run: | + [[ $(uname) == Linux ]] && sudo apt-get install --yes rpm tcsh fish zsh + [[ $(uname) == Darwin ]] && brew install bash tcsh fish + python -m pip install --quiet --upgrade codecov + - run: make install + - run: make lint + - run: make test + - uses: codecov/codecov-action@v3 + black: + runs-on: ubuntu-22.04 + steps: + - uses: psf/black@stable + isort: + runs-on: ubuntu-22.04 + steps: + - uses: isort/isort-action@v1.1.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-3.0.8/.gitignore new/argcomplete-3.1.1/.gitignore --- old/argcomplete-3.0.8/.gitignore 1970-01-01 01:00:00.000000000 +0100 +++ new/argcomplete-3.1.1/.gitignore 2023-03-06 20:37:04.000000000 +0100 @@ -0,0 +1,33 @@ +# Reminder: +# - A leading slash means the pattern is anchored at the root. +# - No leading slash means the pattern matches at any depth. + +# Python files +*.pyc +__pycache__/ +*.egg-info/ +/build/ +/dist/ +/.eggs/ +.coverage +.venv + +# IDE project files +/.pydevproject + +# vim python-mode plugin +/.ropeproject + +# IntelliJ IDEA / PyCharm project files +/.idea +/*.iml + +# JS/node/npm/web dev files +node_modules +npm-debug.log + +# OS X metadata files +.DS_Store + +# test +test/test_package/build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-3.0.8/Changes.rst new/argcomplete-3.1.1/Changes.rst --- old/argcomplete-3.0.8/Changes.rst 2023-04-23 23:45:09.000000000 +0200 +++ new/argcomplete-3.1.1/Changes.rst 2023-06-12 01:37:42.000000000 +0200 @@ -1,3 +1,24 @@ +Changes for v3.1.1 (2023-06-11) +=============================== + +- Search through asdf shims + +- Use \` as escape character in PowerShell (#434) + +Changes for v3.1.0 (2023-06-10) +=============================== + +- setup.py -> pyproject.toml migration start (#427) + +- Improve user install logic in activate-global-python-argcomplete + (#437) + +- Ensure Python 3.7 compatibility in check_console_script (#436) + +- ZSH implementation fixes (#431, #433) + +- Documentation improvements + Changes for v3.0.8 (2023-04-23) =============================== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-3.0.8/Makefile new/argcomplete-3.1.1/Makefile --- old/argcomplete-3.0.8/Makefile 1970-01-01 01:00:00.000000000 +0100 +++ new/argcomplete-3.1.1/Makefile 2023-06-03 17:24:48.000000000 +0200 @@ -0,0 +1,32 @@ +SHELL=/bin/bash + +test_deps: + python -m pip install .[test] + +lint: + for dir in $$(dirname */__init__.py); do ruff $$dir; done + for script in scripts/*[^cmd]; do if grep -q python $$script; then ruff $$script; fi; done + mypy --install-types --non-interactive --check-untyped-defs argcomplete + +test: + coverage run --source=argcomplete --omit=argcomplete/packages/_shlex.py ./test/test.py -v + +init_docs: + cd docs; sphinx-quickstart + +docs: + python -m pip install furo sphinx-copybutton sphinxext-opengraph + sphinx-build docs docs/html + +install: clean + python -m pip install build + python -m build + python -m pip install --upgrade $$(echo dist/*.whl)[test] + +clean: + -rm -rf build dist + -rm -rf *.egg-info + +.PHONY: test_deps lint test docs install clean + +include common.mk diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-3.0.8/PKG-INFO new/argcomplete-3.1.1/PKG-INFO --- old/argcomplete-3.0.8/PKG-INFO 2023-04-23 23:45:39.245201000 +0200 +++ new/argcomplete-3.1.1/PKG-INFO 2023-06-12 01:38:19.720147000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: argcomplete -Version: 3.0.8 +Version: 3.1.1 Summary: Bash tab completion for argparse Home-page: https://github.com/kislyuk/argcomplete Author: Andrey Kislyuk @@ -32,6 +32,7 @@ Classifier: Topic :: System :: Shells Classifier: Topic :: Terminals Requires-Python: >=3.6 +Description-Content-Type: text/x-rst Provides-Extra: test License-File: LICENSE.rst License-File: NOTICE @@ -58,7 +59,7 @@ pip install argcomplete activate-global-python-argcomplete -On Linux, you will need to run the second command with ``sudo``. See `Activating global completion`_ below for details. +See `Activating global completion`_ below for details about the second step. Refresh your shell environment (start a new shell). @@ -250,9 +251,8 @@ will look for the string **PYTHON_ARGCOMPLETE_OK** in the first 1024 bytes of any executable that it's running completion for, and if it's found, follow the rest of the argcomplete protocol as described above. -Additionally, completion is activated for scripts run as ``python <script>`` and ``python -m <module>``. -This also works for alternate Python versions (e.g. ``python3`` and ``pypy``), as long as that version of Python has -argcomplete installed. +Additionally, completion is activated for scripts run as ``python <script>`` and ``python -m <module>``. If you're using +multiple Python versions on the same system, the version being used to run the script must have argcomplete installed. .. admonition:: Bash version compatibility @@ -275,12 +275,10 @@ Activating global completion ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The script ``activate-global-python-argcomplete`` will try to install the global completion script -``bash_completion.d/python-argcomplete`` (`see on GitHub`_) into an appropriate location on your system for both bash -and zsh (``/etc/bash_completion.d`` and ``/usr/local/share/zsh/site-functions``). On Linux, you will need to run the -script with sudo: ``sudo activate-global-python-argcomplete``, or run the script with ``--help`` to see other options. - -.. _`see on GitHub`: https://github.com/kislyuk/argcomplete/blob/master/argcomplete/bash_completion.d/python-argcomplete +The script ``activate-global-python-argcomplete`` installs the global completion script +`bash_completion.d/_python-argcomplete <https://github.com/kislyuk/argcomplete/blob/master/argcomplete/bash_completion.d/_python-argcomplete>`_ +into an appropriate location on your system for both bash and zsh. The specific location depends on your platform and +whether you installed argcomplete system-wide using ``sudo`` or locally (into your user's home directory). Zsh Support ----------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-3.0.8/README.rst new/argcomplete-3.1.1/README.rst --- old/argcomplete-3.0.8/README.rst 2023-04-23 23:34:49.000000000 +0200 +++ new/argcomplete-3.1.1/README.rst 2023-06-10 22:21:43.000000000 +0200 @@ -20,7 +20,7 @@ pip install argcomplete activate-global-python-argcomplete -On Linux, you will need to run the second command with ``sudo``. See `Activating global completion`_ below for details. +See `Activating global completion`_ below for details about the second step. Refresh your shell environment (start a new shell). @@ -212,9 +212,8 @@ will look for the string **PYTHON_ARGCOMPLETE_OK** in the first 1024 bytes of any executable that it's running completion for, and if it's found, follow the rest of the argcomplete protocol as described above. -Additionally, completion is activated for scripts run as ``python <script>`` and ``python -m <module>``. -This also works for alternate Python versions (e.g. ``python3`` and ``pypy``), as long as that version of Python has -argcomplete installed. +Additionally, completion is activated for scripts run as ``python <script>`` and ``python -m <module>``. If you're using +multiple Python versions on the same system, the version being used to run the script must have argcomplete installed. .. admonition:: Bash version compatibility @@ -237,12 +236,10 @@ Activating global completion ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The script ``activate-global-python-argcomplete`` will try to install the global completion script -``bash_completion.d/python-argcomplete`` (`see on GitHub`_) into an appropriate location on your system for both bash -and zsh (``/etc/bash_completion.d`` and ``/usr/local/share/zsh/site-functions``). On Linux, you will need to run the -script with sudo: ``sudo activate-global-python-argcomplete``, or run the script with ``--help`` to see other options. - -.. _`see on GitHub`: https://github.com/kislyuk/argcomplete/blob/master/argcomplete/bash_completion.d/python-argcomplete +The script ``activate-global-python-argcomplete`` installs the global completion script +`bash_completion.d/_python-argcomplete <https://github.com/kislyuk/argcomplete/blob/master/argcomplete/bash_completion.d/_python-argcomplete>`_ +into an appropriate location on your system for both bash and zsh. The specific location depends on your platform and +whether you installed argcomplete system-wide using ``sudo`` or locally (into your user's home directory). Zsh Support ----------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-3.0.8/SECURITY.md new/argcomplete-3.1.1/SECURITY.md --- old/argcomplete-3.0.8/SECURITY.md 1970-01-01 01:00:00.000000000 +0100 +++ new/argcomplete-3.1.1/SECURITY.md 2023-03-05 06:26:24.000000000 +0100 @@ -0,0 +1,9 @@ +# Security Policy + +## Reporting a Vulnerability + +If you believe you have found a security vulnerability in this project, please report it to us by submitting a security advisory at https://github.com/kislyuk/argcomplete/security/advisories. You can expect an initial response within 14 days. + +## Supported Versions + +In general, the maintainers of this project provide security updates only for the most recent published release. If you need support for prior versions, please open an issue and describe your situation. Requests for updates to prior releases will be considered on a case-by-case basis, and will generally be accommodated only for the latest releases in prior major version release series. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-3.0.8/argcomplete/_check_console_script.py new/argcomplete-3.1.1/argcomplete/_check_console_script.py --- old/argcomplete-3.0.8/argcomplete/_check_console_script.py 2023-03-05 00:22:21.000000000 +0100 +++ new/argcomplete-3.1.1/argcomplete/_check_console_script.py 2023-06-05 18:46:08.000000000 +0200 @@ -16,10 +16,15 @@ try: from importlib.metadata import entry_points as importlib_entry_points + from importlib.metadata import EntryPoint + use_entry_points_backport = False except ImportError: from importlib_metadata import entry_points as importlib_entry_points # type:ignore + from importlib_metadata import EntryPoint # type:ignore + use_entry_points_backport = True from ._check_module import ArgcompleteMarkerNotFound, find +from typing import Iterable def main(): @@ -29,7 +34,17 @@ # 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] + + entry_points : Iterable[EntryPoint] = importlib_entry_points() # type:ignore + + # The importlib_metadata backport returns a tuple of entry point objects + # whereas the official library returns a SelectableGroups object + if not use_entry_points_backport: + 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 + if not entry_points: raise ArgcompleteMarkerNotFound("no entry point found matching script") entry_point = entry_points[0] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-3.0.8/argcomplete/bash_completion.d/_python-argcomplete new/argcomplete-3.1.1/argcomplete/bash_completion.d/_python-argcomplete --- old/argcomplete-3.0.8/argcomplete/bash_completion.d/_python-argcomplete 1970-01-01 01:00:00.000000000 +0100 +++ new/argcomplete-3.1.1/argcomplete/bash_completion.d/_python-argcomplete 2023-06-12 01:31:03.000000000 +0200 @@ -0,0 +1,236 @@ +#compdef -P * + +# 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 + +# Copy of __expand_tilde_by_ref from bash-completion +# ZSH implementation added +__python_argcomplete_expand_tilde_by_ref () { + if [ -n "${ZSH_VERSION-}" ]; then + if [ "${(P)1[1]}" = "~" ]; then + eval $1="${(P)1/#\~/$HOME}"; + fi + else + if [ "${!1:0:1}" = "~" ]; then + if [ "${!1}" != "${!1//\/}" ]; then + eval $1="${!1/%\/*}"/'${!1#*/}'; + else + eval $1="${!1}"; + fi; + fi + fi +} + +# Run something, muting output or redirecting it to the debug stream +# depending on the value of _ARC_DEBUG. +# If ARGCOMPLETE_USE_TEMPFILES is set, use tempfiles for IPC. +__python_argcomplete_run() { + if [[ -z "${ARGCOMPLETE_USE_TEMPFILES-}" ]]; then + __python_argcomplete_run_inner "$@" + return + fi + local tmpfile="$(mktemp)" + _ARGCOMPLETE_STDOUT_FILENAME="$tmpfile" __python_argcomplete_run_inner "$@" + local code=$? + cat "$tmpfile" + rm "$tmpfile" + return $code +} + +__python_argcomplete_run_inner() { + 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_upshift_bash_rematch() { + if [[ -z "${ZSH_VERSION-}" ]]; then + _BASH_REMATCH=( "" "${BASH_REMATCH[@]}" ) + else + _BASH_REMATCH=( "${BASH_REMATCH[@]}" ) + fi +} + +# This function scans the beginning of an executable file provided as the first +# argument ($1) for certain indicators, specified by the second argument ($2), +# or the "target". There are three possible targets: "interpreter", +# "magic_string", and "easy_install". If the target is "interpreter", the +# function matches the interpreter line, alongside any optional interpreter +# arguments. If the target is "magic_string", a match is attempted for the +# "PYTHON_ARGCOMPLETE_OK" magic string, indicating that the file should be run +# to get completions. If the target is "easy_install", the function matches either +# "PBR Generated" or any of the "EASY-INSTALL" scripts (either SCRIPT, +# ENTRY-SCRIPT, or DEV-SCRIPT). In all cases, only the first kilobyte of +# the file is searched. The regex matches are returned in BASH_REMATCH, +# indexed starting at 1, regardless of the shell in use. +__python_argcomplete_scan_head() { + local file="$1" + local target="$2" + + if [[ -n "${ZSH_VERSION-}" ]]; then + read -r -k 1024 -u 0 < "$file"; + else + read -r -N 1024 < "$file" + fi + + # Since ZSH does not support a -n option, we + # trim all characters after the first line in both shells + if [[ "$target" = "interpreter" ]]; then + read -r <<< "$REPLY" + fi + + local regex + + case "$target" in + magic_string) regex='PYTHON_ARGCOMPLETE_OK' ;; + easy_install) regex="(PBR Generated)|(EASY-INSTALL-(SCRIPT|ENTRY-SCRIPT|DEV-SCRIPT))" ;; + asdf) regex="asdf exec " ;; + interpreter) regex='^#!(.*)$' ;; + esac + + local ret="" + if [[ "$REPLY" =~ $regex ]]; then + ret=1 + fi + + __python_argcomplete_upshift_bash_rematch + + [[ -n $ret ]] +} + +__python_argcomplete_scan_head_noerr() { + __python_argcomplete_scan_head "$@" 2>/dev/null +} + +__python_argcomplete_which() { + if [[ -n "${ZSH_VERSION-}" ]]; then + whence -p "$@" + else + type -P "$@" + fi +} + +_python_argcomplete_global() { + + if [[ -n "${ZSH_VERSION-}" ]]; then + # Store result of a regex match in the + # BASH_REMATCH variable rather than MATCH + setopt local_options BASH_REMATCH + fi + + # 1-based version of BASH_REMATCH. Modifying BASH_REMATCH + # directly causes older versions of Bash to exit + local _BASH_REMATCH=""; + + local executable="" + + # req_argv contains the arguments to the completion + # indexed from 1 (regardless of the shell.) In Bash, + # the zeroth index is empty + local req_argv=() + + if [[ -z "${ZSH_VERSION-}" ]]; then + executable=$1 + req_argv=( "" "${COMP_WORDS[@]:1}" ) + __python_argcomplete_expand_tilde_by_ref executable + else + # TODO: check if we should call _default or use a different condition here + if [[ "$service" != "-default-" ]]; then + return + fi + executable="${words[1]}" + req_argv=( "${words[@]:1}" ) + fi + + local ARGCOMPLETE=0 + if [[ "$executable" == python* ]] || [[ "$executable" == pypy* ]]; then + if [[ "${req_argv[1]}" == -m ]]; then + if __python_argcomplete_run "$executable" -m argcomplete._check_module "${req_argv[2]}"; then + ARGCOMPLETE=3 + else + return + fi + fi + if [[ $ARGCOMPLETE == 0 ]]; then + local potential_path="${req_argv[1]}" + __python_argcomplete_expand_tilde_by_ref potential_path + if [[ -f "$potential_path" ]] && __python_argcomplete_scan_head_noerr "$potential_path" magic_string; then + req_argv[1]="$potential_path" # not expanded in __python_argcomplete_run + ARGCOMPLETE=2 + else + return + fi + fi + elif __python_argcomplete_which "$executable" >/dev/null 2>&1; then + local SCRIPT_NAME=$(__python_argcomplete_which "$executable") + __python_argcomplete_scan_head_noerr "$SCRIPT_NAME" interpreter + if (__python_argcomplete_which pyenv && [[ "$SCRIPT_NAME" = $(pyenv root)/shims/* ]]) >/dev/null 2>&1; then + local SCRIPT_NAME=$(pyenv which "$executable") + fi + if (__python_argcomplete_which asdf && __python_argcomplete_scan_head_noerr "$SCRIPT_NAME" asdf) >/dev/null 2>&1; then + local SCRIPT_NAME=$(asdf which "$executable") + fi + if __python_argcomplete_scan_head_noerr "$SCRIPT_NAME" magic_string; then + ARGCOMPLETE=1 + elif __python_argcomplete_scan_head_noerr "$SCRIPT_NAME" interpreter; then + __python_argcomplete_upshift_bash_rematch + local interpreter="${_BASH_REMATCH[2]}" + + if [[ -n "${ZSH_VERSION-}" ]]; then + interpreter=($=interpreter) + else + interpreter=($interpreter) + fi + + if (__python_argcomplete_scan_head_noerr "$SCRIPT_NAME" easy_install \ + && "${interpreter[@]}" "$(__python_argcomplete_which python-argcomplete-check-easy-install-script)" "$SCRIPT_NAME") >/dev/null 2>&1; then + ARGCOMPLETE=1 + elif __python_argcomplete_run "${interpreter[@]}" -m argcomplete._check_console_script "$SCRIPT_NAME"; then + ARGCOMPLETE=1 + fi + fi + fi + + if [[ $ARGCOMPLETE != 0 ]]; then + local IFS=$'\013' + if [[ -n "${ZSH_VERSION-}" ]]; then + local completions + completions=($(IFS="$IFS" \ + COMP_LINE="$BUFFER" \ + COMP_POINT="$CURSOR" \ + _ARGCOMPLETE=$ARGCOMPLETE \ + _ARGCOMPLETE_SHELL="zsh" \ + _ARGCOMPLETE_SUPPRESS_SPACE=1 \ + __python_argcomplete_run "$executable" "${(@)req_argv[1, ${ARGCOMPLETE}-1]}")) + _describe "$executable" completions + else + COMPREPLY=($(IFS="$IFS" \ + COMP_LINE="$COMP_LINE" \ + COMP_POINT="$COMP_POINT" \ + COMP_TYPE="$COMP_TYPE" \ + _ARGCOMPLETE_COMP_WORDBREAKS="$COMP_WORDBREAKS" \ + _ARGCOMPLETE=$ARGCOMPLETE \ + _ARGCOMPLETE_SHELL="bash" \ + _ARGCOMPLETE_SUPPRESS_SPACE=1 \ + __python_argcomplete_run "$executable" "${req_argv[@]:1:${ARGCOMPLETE}-1}")) + if [[ $? != 0 ]]; then + unset COMPREPLY + elif [[ "${COMPREPLY-}" =~ [=/:]$ ]]; then + compopt -o nospace + fi + fi + elif [[ -n "${ZSH_VERSION-}" ]]; then + _default + else + type -t _completion_loader | grep -q 'function' && _completion_loader "$@" + fi +} +if [[ -z "${ZSH_VERSION-}" ]]; then + complete -o default -o bashdefault -D -F _python_argcomplete_global +else + compdef _python_argcomplete_global -P '*' +fi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-3.0.8/argcomplete/bash_completion.d/python-argcomplete new/argcomplete-3.1.1/argcomplete/bash_completion.d/python-argcomplete --- old/argcomplete-3.0.8/argcomplete/bash_completion.d/python-argcomplete 2023-03-29 04:42:12.000000000 +0200 +++ new/argcomplete-3.1.1/argcomplete/bash_completion.d/python-argcomplete 1970-01-01 01:00:00.000000000 +0100 @@ -1,147 +0,0 @@ -#compdef -P * - -# Copyright 2012-2023, 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. -# If ARGCOMPLETE_USE_TEMPFILES is set, use tempfiles for IPC. -__python_argcomplete_run() { - if [[ -z "${ARGCOMPLETE_USE_TEMPFILES-}" ]]; then - __python_argcomplete_run_inner "$@" - return - fi - local tmpfile="$(mktemp)" - _ARGCOMPLETE_STDOUT_FILENAME="$tmpfile" __python_argcomplete_run_inner "$@" - local code=$? - cat "$tmpfile" - rm "$tmpfile" - return $code -} - -__python_argcomplete_run_inner() { - 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() { - if [[ -n "${ZSH_VERSION-}" ]]; then - read -s -r -k 1024 -u 0 < "$1" - else - read -s -r ${3:--N} 1024 < "$1" - fi - [[ "$REPLY" =~ ${2:-PYTHON_ARGCOMPLETE_OK} ]] -} - -__python_argcomplete_scan_head_noerr() { - __python_argcomplete_scan_head "$@" 2>/dev/null -} - -__python_argcomplete_which() { - if [[ -n "${ZSH_VERSION-}" ]]; then - whence -p "$@" - else - type -P "$@" - fi -} - -_python_argcomplete_global() { - if [[ -z "${ZSH_VERSION-}" ]]; then - local executable=$1 - __python_argcomplete_expand_tilde_by_ref executable - else - # TODO: check if we should call _default or use a different condition here - if [[ "$service" != "-default-" ]]; then - return - fi - local executable=${words[1]} - fi - - 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 __python_argcomplete_which "$executable" >/dev/null 2>&1; then - local SCRIPT_NAME=$(__python_argcomplete_which "$executable") - if (__python_argcomplete_which 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" "$(__python_argcomplete_which 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=$'\013' - if [[ -n "${ZSH_VERSION-}" ]]; then - local completions - completions=($(IFS="$IFS" \ - COMP_LINE="$BUFFER" \ - COMP_POINT="$CURSOR" \ - _ARGCOMPLETE=$ARGCOMPLETE \ - _ARGCOMPLETE_SHELL="zsh" \ - _ARGCOMPLETE_SUPPRESS_SPACE=1 \ - __python_argcomplete_run "$executable" "${words[@]:1:${ARGCOMPLETE}-1}")) - _describe "$executable" completions -o nosort - else - COMPREPLY=($(IFS="$IFS" \ - COMP_LINE="$COMP_LINE" \ - COMP_POINT="$COMP_POINT" \ - COMP_TYPE="$COMP_TYPE" \ - _ARGCOMPLETE_COMP_WORDBREAKS="$COMP_WORDBREAKS" \ - _ARGCOMPLETE=$ARGCOMPLETE \ - _ARGCOMPLETE_SHELL="bash" \ - _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 - fi - elif [[ -n "${ZSH_VERSION-}" ]]; then - _default - else - type -t _completion_loader | grep -q 'function' && _completion_loader "$@" - fi -} -if [[ -z "${ZSH_VERSION-}" ]]; then - complete -o default -o bashdefault -D -F _python_argcomplete_global -else - compdef _python_argcomplete_global -P '*' -fi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-3.0.8/argcomplete/finders.py new/argcomplete-3.1.1/argcomplete/finders.py --- old/argcomplete-3.0.8/argcomplete/finders.py 2023-03-29 04:42:12.000000000 +0200 +++ new/argcomplete-3.1.1/argcomplete/finders.py 2023-06-12 01:35:19.000000000 +0200 @@ -519,8 +519,14 @@ special_chars = "" completions = [c.replace("'", r"'\''") for c in completions] + # PowerShell uses ` as escape character. + if os.environ.get("_ARGCOMPLETE_SHELL") == "powershell": + escape_char = '`' + special_chars = special_chars.replace('`', '') + else: + escape_char = "\\" for char in special_chars: - completions = [c.replace(char, "\\" + char) for c in completions] + completions = [c.replace(char, escape_char + char) for c in completions] if self.append_space: # Similar functionality in bash was previously turned off by supplying the "-o nospace" option to complete. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-3.0.8/argcomplete/shell_integration.py new/argcomplete-3.1.1/argcomplete/shell_integration.py --- old/argcomplete-3.0.8/argcomplete/shell_integration.py 2023-04-23 23:34:49.000000000 +0200 +++ new/argcomplete-3.1.1/argcomplete/shell_integration.py 2023-06-12 01:34:29.000000000 +0200 @@ -105,13 +105,14 @@ $env:_ARGCOMPLETE = 1 $env:_ARGCOMPLETE_SUPPRESS_SPACE = 0 $env:_ARGCOMPLETE_IFS = "`n" + $env:_ARGCOMPLETE_SHELL = "powershell" %(argcomplete_script)s 2>&1 | Out-Null Get-Content $completion_file | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_, $_, "ParameterValue", $_) } rm $completion_file - Remove-Item Env:\_ARGCOMPLETE_STDOUT_FILENAME, Env:\ARGCOMPLETE_USE_TEMPFILES, Env:\COMP_LINE, Env:\COMP_POINT, Env:\_ARGCOMPLETE, Env:\_ARGCOMPLETE_SUPPRESS_SPACE, Env:\_ARGCOMPLETE_IFS + Remove-Item Env:\_ARGCOMPLETE_STDOUT_FILENAME, Env:\ARGCOMPLETE_USE_TEMPFILES, Env:\COMP_LINE, Env:\COMP_POINT, Env:\_ARGCOMPLETE, Env:\_ARGCOMPLETE_SUPPRESS_SPACE, Env:\_ARGCOMPLETE_IFS, Env:\_ARGCOMPLETE_SHELL } """ # noqa: E501 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-3.0.8/argcomplete.egg-info/PKG-INFO new/argcomplete-3.1.1/argcomplete.egg-info/PKG-INFO --- old/argcomplete-3.0.8/argcomplete.egg-info/PKG-INFO 2023-04-23 23:45:39.000000000 +0200 +++ new/argcomplete-3.1.1/argcomplete.egg-info/PKG-INFO 2023-06-12 01:38:19.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: argcomplete -Version: 3.0.8 +Version: 3.1.1 Summary: Bash tab completion for argparse Home-page: https://github.com/kislyuk/argcomplete Author: Andrey Kislyuk @@ -32,6 +32,7 @@ Classifier: Topic :: System :: Shells Classifier: Topic :: Terminals Requires-Python: >=3.6 +Description-Content-Type: text/x-rst Provides-Extra: test License-File: LICENSE.rst License-File: NOTICE @@ -58,7 +59,7 @@ pip install argcomplete activate-global-python-argcomplete -On Linux, you will need to run the second command with ``sudo``. See `Activating global completion`_ below for details. +See `Activating global completion`_ below for details about the second step. Refresh your shell environment (start a new shell). @@ -250,9 +251,8 @@ will look for the string **PYTHON_ARGCOMPLETE_OK** in the first 1024 bytes of any executable that it's running completion for, and if it's found, follow the rest of the argcomplete protocol as described above. -Additionally, completion is activated for scripts run as ``python <script>`` and ``python -m <module>``. -This also works for alternate Python versions (e.g. ``python3`` and ``pypy``), as long as that version of Python has -argcomplete installed. +Additionally, completion is activated for scripts run as ``python <script>`` and ``python -m <module>``. If you're using +multiple Python versions on the same system, the version being used to run the script must have argcomplete installed. .. admonition:: Bash version compatibility @@ -275,12 +275,10 @@ Activating global completion ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The script ``activate-global-python-argcomplete`` will try to install the global completion script -``bash_completion.d/python-argcomplete`` (`see on GitHub`_) into an appropriate location on your system for both bash -and zsh (``/etc/bash_completion.d`` and ``/usr/local/share/zsh/site-functions``). On Linux, you will need to run the -script with sudo: ``sudo activate-global-python-argcomplete``, or run the script with ``--help`` to see other options. - -.. _`see on GitHub`: https://github.com/kislyuk/argcomplete/blob/master/argcomplete/bash_completion.d/python-argcomplete +The script ``activate-global-python-argcomplete`` installs the global completion script +`bash_completion.d/_python-argcomplete <https://github.com/kislyuk/argcomplete/blob/master/argcomplete/bash_completion.d/_python-argcomplete>`_ +into an appropriate location on your system for both bash and zsh. The specific location depends on your platform and +whether you installed argcomplete system-wide using ``sudo`` or locally (into your user's home directory). Zsh Support ----------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-3.0.8/argcomplete.egg-info/SOURCES.txt new/argcomplete-3.1.1/argcomplete.egg-info/SOURCES.txt --- old/argcomplete-3.0.8/argcomplete.egg-info/SOURCES.txt 2023-04-23 23:45:39.000000000 +0200 +++ new/argcomplete-3.1.1/argcomplete.egg-info/SOURCES.txt 2023-06-12 01:38:19.000000000 +0200 @@ -1,12 +1,18 @@ +.gitignore Authors.rst Changes.rst LICENSE.rst MANIFEST.in +Makefile NOTICE README.rst +SECURITY.md +common.mk pyproject.toml setup.cfg setup.py +.github/FUNDING.yml +.github/workflows/ci.yml argcomplete/__init__.py argcomplete/_check_console_script.py argcomplete/_check_module.py @@ -23,10 +29,17 @@ argcomplete.egg-info/not-zip-safe argcomplete.egg-info/requires.txt argcomplete.egg-info/top_level.txt -argcomplete/bash_completion.d/python-argcomplete +argcomplete/bash_completion.d/_python-argcomplete argcomplete/packages/__init__.py argcomplete/packages/_argparse.py argcomplete/packages/_shlex.py +contrib/README.rst +docs/changelog.rst +docs/conf.py +docs/fish_help_string.png +docs/index.rst +docs/toc.html +docs/examples/describe_github_user.py scripts/activate-global-python-argcomplete scripts/python-argcomplete-check-easy-install-script scripts/register-python-argcomplete diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-3.0.8/argcomplete.egg-info/requires.txt new/argcomplete-3.1.1/argcomplete.egg-info/requires.txt --- old/argcomplete-3.0.8/argcomplete.egg-info/requires.txt 2023-04-23 23:45:39.000000000 +0200 +++ new/argcomplete-3.1.1/argcomplete.egg-info/requires.txt 2023-06-12 01:38:19.000000000 +0200 @@ -1,8 +1,5 @@ -[:python_version == "3.6"] -importlib-metadata<7,>=0.23 - -[:python_version == "3.7"] +[:python_version < "3.8"] importlib-metadata<7,>=0.23 [test] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-3.0.8/common.mk new/argcomplete-3.1.1/common.mk --- old/argcomplete-3.0.8/common.mk 1970-01-01 01:00:00.000000000 +0100 +++ new/argcomplete-3.1.1/common.mk 2023-06-12 01:26:52.000000000 +0200 @@ -0,0 +1,52 @@ +SHELL=/bin/bash -eo pipefail + +release-major: + $(eval export TAG=$(shell git describe --tags --match 'v*.*.*' | perl -ne '/^v(\d+)\.(\d+)\.(\d+)/; print "v@{[$$1+1]}.0.0"')) + $(MAKE) release + +release-minor: + $(eval export TAG=$(shell git describe --tags --match 'v*.*.*' | perl -ne '/^v(\d+)\.(\d+)\.(\d+)/; print "v$$1.@{[$$2+1]}.0"')) + $(MAKE) release + +release-patch: + $(eval export TAG=$(shell git describe --tags --match 'v*.*.*' | perl -ne '/^v(\d+)\.(\d+)\.(\d+)/; print "v$$1.$$2.@{[$$3+1]}"')) + $(MAKE) release + +release: + @if ! git diff --cached --exit-code; then echo "Commit staged files before proceeding"; exit 1; fi + @if [[ -z $$TAG ]]; then echo "Use release-{major,minor,patch}"; exit 1; fi + @if ! type -P pandoc; then echo "Please install pandoc"; exit 1; fi + @if ! type -P sponge; then echo "Please install moreutils"; exit 1; fi + @if ! type -P gh; then echo "Please install gh"; exit 1; fi + @if ! type -P twine; then echo "Please install twine"; exit 1; fi + git pull + git clean -x --force $$(python setup.py --name) + TAG_MSG=$$(mktemp); \ + echo "# Changes for ${TAG} ($$(date +%Y-%m-%d))" > $$TAG_MSG; \ + git log --pretty=format:%s $$(git describe --abbrev=0)..HEAD >> $$TAG_MSG; \ + $${EDITOR:-emacs} $$TAG_MSG; \ + if [[ -f Changes.md ]]; then cat $$TAG_MSG <(echo) Changes.md | sponge Changes.md; git add Changes.md; fi; \ + if [[ -f Changes.rst ]]; then cat <(pandoc --from markdown --to rst $$TAG_MSG) <(echo) Changes.rst | sponge Changes.rst; git add Changes.rst; fi; \ + git commit -m ${TAG}; \ + git tag --sign --annotate --file $$TAG_MSG ${TAG} + git push --follow-tags + $(MAKE) install + gh release create ${TAG} dist/*.whl --notes="$$(git tag --list ${TAG} -n99 | perl -pe 's/^\S+\s*// if $$. == 1' | sed 's/^\s\s\s\s//')" + $(MAKE) release-pypi + $(MAKE) release-docs + +release-pypi: + python -m build + twine upload dist/*.tar.gz dist/*.whl --sign --verbose + +release-docs: + $(MAKE) docs + -git branch -D gh-pages + git checkout -B gh-pages-stage + touch docs/html/.nojekyll + git add --force docs/html + git commit -m "Docs for ${TAG}" + git push --force origin $$(git subtree split --prefix docs/html --branch gh-pages):refs/heads/gh-pages + git checkout - + +.PHONY: release diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-3.0.8/contrib/README.rst new/argcomplete-3.1.1/contrib/README.rst --- old/argcomplete-3.0.8/contrib/README.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/argcomplete-3.1.1/contrib/README.rst 2023-04-23 23:34:49.000000000 +0200 @@ -0,0 +1,57 @@ +Git Bash Support +---------------- +Due to limitations of file descriptor inheritance on Windows, Git Bash not supported out of the box. You can opt in to +using temporary files instead of file descriptors for for IPC by setting the environment variable +``ARGCOMPLETE_USE_TEMPFILES``, e.g. by adding ``export ARGCOMPLETE_USE_TEMPFILES=1`` to ``~/.bashrc``. + +For full support, consider using Bash with the Windows Subsystem for Linux (WSL). + +Fish Support +------------ +To activate completions for fish use:: + + register-python-argcomplete --shell fish my-awesome-script | source + +or create new completion file, e.g:: + + register-python-argcomplete --shell fish my-awesome-script > ~/.config/fish/completions/my-awesome-script.fish + +Completion Description For Fish +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +By default help string is added as completion description. + +.. image:: ../docs/fish_help_string.png + +You can disable this feature by removing ``_ARGCOMPLETE_DFS`` variable, e.g:: + + register-python-argcomplete --shell fish my-awesome-script | grep -v _ARGCOMPLETE_DFS | source + +PowerShell Support +------------------ +To activate completions for PowerShell use:: + + register-python-argcomplete --shell powershell my-awesome-script | Out-String | Invoke-Expression + +or create new completion file, e.g:: + + register-python-argcomplete --shell powershell my-awesome-script > ~/my-awesome-script.psm1 + +To activate this completions file, add the below line in ``$PROFILE``. The simplest way is to run ``notepad $PROFILE`` in PowerShell and edit the file. For more information, see `How to create your profile <https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_profiles?view=powershell-7.3#how-to-create-a-profile>`_ and `Profiles and execution policy <https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_profiles?view=powershell-7.3#profiles-and-execution-policy>`_. :: + + Import-Module "~/my-awesome-script.psm1" + +Xonsh support +------------- +The third-party `xontrib-argcomplete <https://github.com/anki-code/xontrib-argcomplete>`_ project provides support for +argcomplete in the `xonsh <https://github.com/xonsh/xonsh>`_ shell. + +External argcomplete script +--------------------------- +To register an argcomplete script for an arbitrary name, the ``--external-argcomplete-script`` argument of the +``register-python-argcomplete`` script can be used:: + + eval "$(register-python-argcomplete --external-argcomplete-script /path/to/script arbitrary-name)" + +This allows, for example, to use the auto completion functionality of argcomplete for an application not written in +Python. The command line interface of this program must be additionally implemented in a Python script with argparse and +argcomplete; whenever the application is called, the registered external argcomplete script is used for autocompletion. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-3.0.8/docs/changelog.rst new/argcomplete-3.1.1/docs/changelog.rst --- old/argcomplete-3.0.8/docs/changelog.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/argcomplete-3.1.1/docs/changelog.rst 2023-06-03 17:24:48.000000000 +0200 @@ -0,0 +1,3 @@ +Release Notes +============= +.. include:: ../Changes.rst diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-3.0.8/docs/conf.py new/argcomplete-3.1.1/docs/conf.py --- old/argcomplete-3.0.8/docs/conf.py 1970-01-01 01:00:00.000000000 +0100 +++ new/argcomplete-3.1.1/docs/conf.py 2023-06-03 17:24:48.000000000 +0200 @@ -0,0 +1,42 @@ +import os + +project = "argcomplete" +copyright = "Andrey Kislyuk and argcomplete contributors" +author = "Andrey Kislyuk" +version = "" +release = "" +language = "en" +master_doc = "index" +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.viewcode", + "sphinx.ext.intersphinx", + "sphinx_copybutton", + "sphinxext.opengraph", +] +source_suffix = [".rst", ".md"] +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] +pygments_style = "sphinx" +autodoc_member_order = "bysource" +autodoc_typehints = "description" +autodoc_typehints_description_target = "documented_params" +intersphinx_mapping = { + "https://docs.python.org/3": None, +} +templates_path = [""] +ogp_site_url = "https://kislyuk.github.io/" + project + +if "readthedocs.org" in os.getcwd().split("/"): + with open("index.rst", "w") as fh: + fh.write("Documentation for this project has moved to https://kislyuk.github.io/" + project) +else: + html_theme = "furo" + html_sidebars = { + "**": [ + "sidebar/brand.html", + "sidebar/search.html", + "sidebar/scroll-start.html", + "toc.html", + "sidebar/scroll-end.html", + ] + } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-3.0.8/docs/examples/describe_github_user.py new/argcomplete-3.1.1/docs/examples/describe_github_user.py --- old/argcomplete-3.0.8/docs/examples/describe_github_user.py 1970-01-01 01:00:00.000000000 +0100 +++ new/argcomplete-3.1.1/docs/examples/describe_github_user.py 2023-03-05 00:22:21.000000000 +0100 @@ -0,0 +1,24 @@ +#!/usr/bin/env python +# PYTHON_ARGCOMPLETE_OK + +import argparse +import pprint + +import requests + +import argcomplete + + +def github_org_members(prefix, parsed_args, **kwargs): + resource = "https://api.github.com/orgs/{org}/members".format(org=parsed_args.organization) + return (member["login"] for member in requests.get(resource).json() if member["login"].startswith(prefix)) + + +parser = argparse.ArgumentParser() +parser.add_argument("--organization", help="GitHub organization") +parser.add_argument("--member", help="GitHub member").completer = github_org_members + +argcomplete.autocomplete(parser) +args = parser.parse_args() + +pprint.pprint(requests.get("https://api.github.com/users/{m}".format(m=args.member)).json()) Binary files old/argcomplete-3.0.8/docs/fish_help_string.png and new/argcomplete-3.1.1/docs/fish_help_string.png differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-3.0.8/docs/index.rst new/argcomplete-3.1.1/docs/index.rst --- old/argcomplete-3.0.8/docs/index.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/argcomplete-3.1.1/docs/index.rst 2023-06-03 17:24:48.000000000 +0200 @@ -0,0 +1,20 @@ +.. include:: ../README.rst + +API documentation +================= + +.. autofunction:: argcomplete.autocomplete + +.. automodule:: argcomplete + :members: + :imported-members: + :special-members: + :exclude-members: __weakref__ + +Change log +========== + +.. toctree:: + :maxdepth: 5 + + changelog diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-3.0.8/docs/toc.html new/argcomplete-3.1.1/docs/toc.html --- old/argcomplete-3.0.8/docs/toc.html 1970-01-01 01:00:00.000000000 +0100 +++ new/argcomplete-3.1.1/docs/toc.html 2023-06-03 17:24:48.000000000 +0200 @@ -0,0 +1 @@ +{{toc}} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-3.0.8/pyproject.toml new/argcomplete-3.1.1/pyproject.toml --- old/argcomplete-3.0.8/pyproject.toml 2023-04-04 04:41:07.000000000 +0200 +++ new/argcomplete-3.1.1/pyproject.toml 2023-06-12 01:26:52.000000000 +0200 @@ -1,3 +1,50 @@ +[build-system] +requires = ["setuptools>=67.7.2", "setuptools_scm[toml]>=6.2"] +build-backend = "setuptools.build_meta" + +[project] +name = "argcomplete" +description = "Bash tab completion for argparse" +readme = "README.rst" +requires-python = ">=3.6" +license = { text = "Apache Software License" } +authors = [{ name = "Andrey Kislyuk"}, {email = "kisl...@gmail.com" }] +maintainers = [] +dynamic = ["version"] +classifiers = [ + "Environment :: Console", + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", + "Operating System :: MacOS :: MacOS X", + "Operating System :: POSIX", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + "Development Status :: 5 - Production/Stable", + "Topic :: Software Development", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: System :: Shells", + "Topic :: Terminals", +] +dependencies = ["importlib-metadata >= 0.23, < 7; python_version < '3.8'"] + +[project.optional-dependencies] +test = ["coverage", "pexpect", "wheel", "ruff", "mypy"] + +[project.urls] +"Documentation"= "https://kislyuk.github.io/argcomplete" +"Source Code"= "https://github.com/kislyuk/argcomplete" +"Issue Tracker"= "https://github.com/kislyuk/argcomplete/issues" +"Change Log"= "https://github.com/kislyuk/argcomplete/blob/master/Changes.rst" + +[tool.setuptools_scm] + [tool.black] line-length = 120 exclude = ".*/version.py" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-3.0.8/scripts/activate-global-python-argcomplete new/argcomplete-3.1.1/scripts/activate-global-python-argcomplete --- old/argcomplete-3.0.8/scripts/activate-global-python-argcomplete 2023-03-22 01:11:35.000000000 +0100 +++ new/argcomplete-3.1.1/scripts/activate-global-python-argcomplete 2023-06-10 22:21:43.000000000 +0200 @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python # PYTHON_ARGCOMPLETE_OK # Copyright 2012-2023, Andrey Kislyuk and argcomplete contributors. @@ -11,10 +11,23 @@ import argparse import os import shutil +import site import sys import argcomplete +zsh_shellcode = """ +# Begin added by argcomplete +fpath=( {zsh_fpath} "${{fpath[@]}}" ) +# End added by argcomplete +""" + +bash_shellcode = """ +# Begin added by argcomplete +source "{activator}" +# End added by argcomplete +""" + def get_zsh_system_dir(): return "/usr/local/share/zsh/site-functions" @@ -23,14 +36,22 @@ def get_bash_system_dir(): if "BASH_COMPLETION_COMPAT_DIR" in os.environ: return os.environ["BASH_COMPLETION_COMPAT_DIR"] - elif os.path.exists("/etc/bash_completion.d"): - return "/etc/bash_completion.d" + elif sys.platform == "darwin": + return "/usr/local/etc/bash_completion.d" # created by homebrew else: - return "/usr/local/etc/bash_completion.d" + return "/etc/bash_completion.d" # created by bash-completion + + +def get_activator_dir(): + return os.path.join(os.path.abspath(os.path.dirname(argcomplete.__file__)), "bash_completion.d") + + +def get_activator_path(): + return os.path.join(get_activator_dir(), "_python-argcomplete") def install_to_destination(dest): - activator = os.path.join(os.path.dirname(argcomplete.__file__), "bash_completion.d", "python-argcomplete") + activator = get_activator_path() if dest == "-": with open(activator) as fh: sys.stdout.write(fh.read()) @@ -51,6 +72,38 @@ ) +def get_consent(): + while True: + res = input("OK to proceed? [y/n] ") + if res.lower() not in {"y", "n", "yes", "no"}: + print('Please answer "yes" or "no".', file=sys.stderr) + elif res.lower() in {"y", "yes"}: + return True + else: + return False + + +def append_to_config_file(path, shellcode): + if os.path.exists(path): + 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) + get_consent() + print(f"Adding shellcode to {path}...", file=sys.stderr) + with open(path, "a") as fh: + fh.write(shellcode) + print("Added.", file=sys.stderr) + + +def link_user_rcfiles(): + # TODO: warn if running as superuser + zsh_rcfile = os.path.join(os.path.expanduser(os.environ.get("ZDOTDIR", "~")), ".zshenv") + append_to_config_file(zsh_rcfile, zsh_shellcode.format(zsh_fpath=get_activator_dir())) + + bash_completion_user_file = os.path.expanduser("~/.bash_completion") + append_to_config_file(bash_completion_user_file, bash_shellcode.format(activator=get_activator_path())) + + parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) 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") @@ -62,21 +115,19 @@ if args.dest != "-" and not os.path.exists(args.dest): parser.error(f"directory {args.dest} was specified via --dest, but it does not exist") destinations.append(args.dest) -elif args.user: +elif site.ENABLE_USER_SITE and site.USER_SITE in argcomplete.__file__: print( - 'WARNING: zsh has no standard user completions directory. To use global completion with zsh, please run this ' - 'command using sudo, or run "echo $fpath" and install the completion module into one of the listed directories' - ' using "activate-global-python-argcomplete --dest=- > completions-dir/_python-argcomplete".', - file=sys.stderr, + "Argcomplete was installed in the user site local directory. Defaulting to user installation.", + file=sys.stderr ) - user_destination = os.path.expanduser("~/.bash_completion") - if os.path.exists(user_destination): - parser.error( - f'Bash user completion configuration file {user_destination} already exists. Please remove it and try ' - f'again, or use "activate-global-python-argcomplete --dest=- >> {user_destination}".' - ) - destinations.append(os.path.expanduser("~/.bash_completion")) + link_user_rcfiles() +elif sys.prefix != sys.base_prefix: + print("Argcomplete was installed in a virtual environment. Defaulting to user installation.", file=sys.stderr) + link_user_rcfiles() +elif args.user: + link_user_rcfiles() else: + print("Defaulting to system-wide installation.", file=sys.stderr) destinations.append(f"{get_zsh_system_dir()}/_python-argcomplete") destinations.append(f"{get_bash_system_dir()}/python-argcomplete") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-3.0.8/scripts/python-argcomplete-check-easy-install-script new/argcomplete-3.1.1/scripts/python-argcomplete-check-easy-install-script --- old/argcomplete-3.0.8/scripts/python-argcomplete-check-easy-install-script 2023-03-19 20:40:27.000000000 +0100 +++ new/argcomplete-3.1.1/scripts/python-argcomplete-check-easy-install-script 2023-06-10 22:21:43.000000000 +0200 @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python # Copyright 2012-2023, 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-3.0.8/setup.py new/argcomplete-3.1.1/setup.py --- old/argcomplete-3.0.8/setup.py 2023-04-23 23:44:59.000000000 +0200 +++ new/argcomplete-3.1.1/setup.py 2023-06-12 01:26:52.000000000 +0200 @@ -4,59 +4,12 @@ from setuptools import find_packages, setup -install_requires = [] -tests_require = ["coverage", "pexpect", "wheel", "ruff", "mypy"] -importlib_backport_requires = ["importlib-metadata >= 0.23, < 7"] - setup( - name="argcomplete", - version="3.0.8", 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", - "Change Log": "https://github.com/kislyuk/argcomplete/blob/master/Changes.rst", - }, - license="Apache Software License", - author="Andrey Kislyuk", - author_email="kisl...@gmail.com", - description="Bash tab completion for argparse", - long_description=open("README.rst").read(), - python_requires=">=3.6", - install_requires=install_requires, - tests_require=tests_require, - extras_require={ - "test": tests_require, - ':python_version == "3.6"': importlib_backport_requires, - ':python_version == "3.7"': importlib_backport_requires, - }, packages=find_packages(exclude=["test", "test.*"]), scripts=glob.glob("scripts/*"), - package_data={"argcomplete": ["bash_completion.d/python-argcomplete", "py.typed"]}, + package_data={"argcomplete": ["bash_completion.d/_python-argcomplete", "py.typed"]}, zip_safe=False, include_package_data=True, platforms=["MacOS X", "Posix"], - test_suite="test", - classifiers=[ - "Environment :: Console", - "Intended Audience :: Developers", - "License :: OSI Approved :: Apache Software License", - "Operating System :: MacOS :: MacOS X", - "Operating System :: POSIX", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: Implementation :: CPython", - "Programming Language :: Python :: Implementation :: PyPy", - "Development Status :: 5 - Production/Stable", - "Topic :: Software Development", - "Topic :: Software Development :: Libraries :: Python Modules", - "Topic :: System :: Shells", - "Topic :: Terminals", - ], ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argcomplete-3.0.8/test/prog new/argcomplete-3.1.1/test/prog --- old/argcomplete-3.0.8/test/prog 2023-03-05 00:22:21.000000000 +0100 +++ new/argcomplete-3.1.1/test/prog 2023-06-10 22:21:43.000000000 +0200 @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python # PYTHON_ARGCOMPLETE_OK """Test script used by test.TestBash."""