Browse Source

Intermediate changes
commit_hash:1b87b2a6f000ceacee7f53a836db07357c429e18

robot-piglet 1 month ago
parent
commit
ca6fbaf1e9

+ 20 - 19
contrib/python/argcomplete/py3/.dist-info/METADATA

@@ -1,17 +1,18 @@
-Metadata-Version: 2.1
+Metadata-Version: 2.4
 Name: argcomplete
-Version: 3.5.2
+Version: 3.5.3
 Summary: Bash tab completion for argparse
-Home-page: https://github.com/kislyuk/argcomplete
-Author: Andrey Kislyuk
-Author-email: kislyuk@gmail.com
-License: Apache Software License
+Project-URL: Homepage, https://github.com/kislyuk/argcomplete
 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
 Project-URL: Change Log, https://github.com/kislyuk/argcomplete/blob/develop/Changes.rst
-Platform: MacOS X
-Platform: Posix
+Author: Andrey Kislyuk
+Author-email: kislyuk@gmail.com
+License: Apache Software License
+License-File: LICENSE.rst
+License-File: NOTICE
+Classifier: Development Status :: 5 - Production/Stable
 Classifier: Environment :: Console
 Classifier: Intended Audience :: Developers
 Classifier: License :: OSI Approved :: Apache Software License
@@ -27,21 +28,18 @@ Classifier: Programming Language :: Python :: 3.11
 Classifier: Programming Language :: Python :: 3.12
 Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: PyPy
-Classifier: Development Status :: 5 - Production/Stable
 Classifier: Topic :: Software Development
 Classifier: Topic :: Software Development :: Libraries :: Python Modules
 Classifier: Topic :: System :: Shells
 Classifier: Topic :: Terminals
 Requires-Python: >=3.8
-Description-Content-Type: text/x-rst
-License-File: LICENSE.rst
-License-File: NOTICE
 Provides-Extra: test
-Requires-Dist: coverage; extra == "test"
-Requires-Dist: pexpect; extra == "test"
-Requires-Dist: wheel; extra == "test"
-Requires-Dist: ruff; extra == "test"
-Requires-Dist: mypy; extra == "test"
+Requires-Dist: coverage; extra == 'test'
+Requires-Dist: mypy; extra == 'test'
+Requires-Dist: pexpect; extra == 'test'
+Requires-Dist: ruff; extra == 'test'
+Requires-Dist: wheel; extra == 'test'
+Description-Content-Type: text/x-rst
 
 argcomplete - Bash/zsh tab completion for argparse
 ==================================================
@@ -85,6 +83,9 @@ follows:
     args = parser.parse_args()
     ...
 
+If using ``pyproject.toml`` ``[project.scripts]`` entry points, the ``PYTHON_ARGCOMPLETE_OK`` marker should appear
+at the beginning of the file that contains the entry point.
+
 Register your Python application with your shell's completion framework by running ``register-python-argcomplete``::
 
     eval "$(register-python-argcomplete my-python-app)"
@@ -268,9 +269,9 @@ multiple Python versions on the same system, the version being used to run the s
  ``/etc/shells``, and run ``chsh`` to change your shell). You can check the version of the running copy of bash with
  ``echo $BASH_VERSION``.
 
-.. note:: If you use setuptools/distribute ``scripts`` or ``entry_points`` directives to package your module,
+.. note:: If you use ``project.scripts`` directives to provide command line entry points to your package,
  argcomplete will follow the wrapper scripts to their destination and look for ``PYTHON_ARGCOMPLETE_OK`` in the
- destination code.
+ first kilobyte of the file containing the destination code.
 
 If you choose not to use global completion, or ship a completion module that depends on argcomplete, you must register
 your script explicitly using ``eval "$(register-python-argcomplete my-python-app)"``. Standard completion module

+ 5 - 2
contrib/python/argcomplete/py3/README.rst

@@ -40,6 +40,9 @@ follows:
     args = parser.parse_args()
     ...
 
+If using ``pyproject.toml`` ``[project.scripts]`` entry points, the ``PYTHON_ARGCOMPLETE_OK`` marker should appear
+at the beginning of the file that contains the entry point.
+
 Register your Python application with your shell's completion framework by running ``register-python-argcomplete``::
 
     eval "$(register-python-argcomplete my-python-app)"
@@ -223,9 +226,9 @@ multiple Python versions on the same system, the version being used to run the s
  ``/etc/shells``, and run ``chsh`` to change your shell). You can check the version of the running copy of bash with
  ``echo $BASH_VERSION``.
 
-.. note:: If you use setuptools/distribute ``scripts`` or ``entry_points`` directives to package your module,
+.. note:: If you use ``project.scripts`` directives to provide command line entry points to your package,
  argcomplete will follow the wrapper scripts to their destination and look for ``PYTHON_ARGCOMPLETE_OK`` in the
- destination code.
+ first kilobyte of the file containing the destination code.
 
 If you choose not to use global completion, or ship a completion module that depends on argcomplete, you must register
 your script explicitly using ``eval "$(register-python-argcomplete my-python-app)"``. Standard completion module

+ 8 - 4
contrib/python/argcomplete/py3/argcomplete/completers.py

@@ -59,13 +59,17 @@ class FilesCompleter(BaseCompleter):
         completion = []
         if self.allowednames:
             if self.directories:
-                files = _call(["bash", "-c", "compgen -A directory -- '{p}'".format(p=prefix)])
+                # Using 'bind' in this and the following commands is a workaround to a bug in bash
+                # that was fixed in bash 5.3 but affects older versions. Environment variables are not treated
+                # correctly in older versions and calling bind makes them available. For details, see
+                # https://savannah.gnu.org/support/index.php?111125
+                files = _call(["bash", "-c", "bind; compgen -A directory -- '{p}'".format(p=prefix)], stderr=subprocess.DEVNULL)
                 completion += [f + "/" for f in files]
             for x in self.allowednames:
-                completion += _call(["bash", "-c", "compgen -A file -X '!*.{0}' -- '{p}'".format(x, p=prefix)])
+                completion += _call(["bash", "-c", "bind; compgen -A file -X '!*.{0}' -- '{p}'".format(x, p=prefix)], stderr=subprocess.DEVNULL)
         else:
-            completion += _call(["bash", "-c", "compgen -A file -- '{p}'".format(p=prefix)])
-            anticomp = _call(["bash", "-c", "compgen -A directory -- '{p}'".format(p=prefix)])
+            completion += _call(["bash", "-c", "bind; compgen -A file -- '{p}'".format(p=prefix)], stderr=subprocess.DEVNULL)
+            anticomp = _call(["bash", "-c", "bind; compgen -A directory -- '{p}'".format(p=prefix)], stderr=subprocess.DEVNULL)
             completion = list(set(completion) - set(anticomp))
 
             if self.directories:

+ 1 - 1
contrib/python/argcomplete/py3/ya.make

@@ -2,7 +2,7 @@
 
 PY3_LIBRARY()
 
-VERSION(3.5.2)
+VERSION(3.5.3)
 
 LICENSE(Apache-2.0)