summaryrefslogtreecommitdiffstats
path: root/contrib/python
diff options
context:
space:
mode:
authorrobot-piglet <[email protected]>2025-04-06 11:15:26 +0300
committerrobot-piglet <[email protected]>2025-04-06 11:25:56 +0300
commitf437f692d8bead26465db2d5663cacc8bd1971c3 (patch)
treecc9f8f6f273ad5ed6bfa15ea2890e626588156cd /contrib/python
parent7039e8610d725e4d04996e3d84a82f2803fbe574 (diff)
Intermediate changes
commit_hash:65c39fc8ac4420b89c1118208082273710155e1a
Diffstat (limited to 'contrib/python')
-rw-r--r--contrib/python/argcomplete/py3/.dist-info/METADATA2
-rw-r--r--contrib/python/argcomplete/py3/argcomplete/finders.py2
-rw-r--r--contrib/python/argcomplete/py3/argcomplete/packages/_shlex.py3
-rw-r--r--contrib/python/argcomplete/py3/argcomplete/scripts/activate_global_python_argcomplete.py27
-rw-r--r--contrib/python/argcomplete/py3/argcomplete/shell_integration.py3
-rw-r--r--contrib/python/argcomplete/py3/ya.make2
6 files changed, 31 insertions, 8 deletions
diff --git a/contrib/python/argcomplete/py3/.dist-info/METADATA b/contrib/python/argcomplete/py3/.dist-info/METADATA
index bf74fb49610..8eff29ade2e 100644
--- a/contrib/python/argcomplete/py3/.dist-info/METADATA
+++ b/contrib/python/argcomplete/py3/.dist-info/METADATA
@@ -1,6 +1,6 @@
Metadata-Version: 2.4
Name: argcomplete
-Version: 3.6.0
+Version: 3.6.1
Summary: Bash tab completion for argparse
Project-URL: Homepage, https://github.com/kislyuk/argcomplete
Project-URL: Documentation, https://kislyuk.github.io/argcomplete
diff --git a/contrib/python/argcomplete/py3/argcomplete/finders.py b/contrib/python/argcomplete/py3/argcomplete/finders.py
index 793b462eed0..8d248fd973b 100644
--- a/contrib/python/argcomplete/py3/argcomplete/finders.py
+++ b/contrib/python/argcomplete/py3/argcomplete/finders.py
@@ -515,7 +515,7 @@ class CompletionFinder(object):
# Bash mangles completions which contain characters in COMP_WORDBREAKS.
# This workaround has the same effect as __ltrim_colon_completions in bash_completion
# (extended to characters other than the colon).
- if last_wordbreak_pos:
+ if last_wordbreak_pos is not None:
completions = [c[last_wordbreak_pos + 1 :] for c in completions]
special_chars += "();<>|&!`$* \t\n\"'"
elif cword_prequote == '"':
diff --git a/contrib/python/argcomplete/py3/argcomplete/packages/_shlex.py b/contrib/python/argcomplete/py3/argcomplete/packages/_shlex.py
index ecd785b80bb..890a38f43f9 100644
--- a/contrib/python/argcomplete/py3/argcomplete/packages/_shlex.py
+++ b/contrib/python/argcomplete/py3/argcomplete/packages/_shlex.py
@@ -177,6 +177,9 @@ class shlex:
elif self.whitespace_split:
self.token = nextchar
self.state = 'a'
+ # Modified by argcomplete: Record last wordbreak position
+ if nextchar in self.wordbreaks:
+ self.last_wordbreak_pos = len(self.token) - 1
else:
self.token = nextchar
if self.token or (self.posix and quoted):
diff --git a/contrib/python/argcomplete/py3/argcomplete/scripts/activate_global_python_argcomplete.py b/contrib/python/argcomplete/py3/argcomplete/scripts/activate_global_python_argcomplete.py
index 768b8aa6bf3..299d081c0ea 100644
--- a/contrib/python/argcomplete/py3/argcomplete/scripts/activate_global_python_argcomplete.py
+++ b/contrib/python/argcomplete/py3/argcomplete/scripts/activate_global_python_argcomplete.py
@@ -121,16 +121,33 @@ def append_to_config_file(path, shellcode):
fh.write(shellcode)
print("Added.", file=sys.stderr)
-
-def link_user_rcfiles():
- # TODO: warn if running as superuser
+def link_zsh_user_rcfile(zsh_fpath=None):
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()))
+ append_to_config_file(zsh_rcfile, zsh_shellcode.format(zsh_fpath=zsh_fpath or get_activator_dir()))
+def link_bash_user_rcfile():
bash_completion_user_file = os.path.expanduser("~/.bash_completion")
append_to_config_file(bash_completion_user_file, bash_shellcode.format(activator=get_activator_path()))
+def link_user_rcfiles():
+ # TODO: warn if running as superuser
+ link_zsh_user_rcfile()
+ link_bash_user_rcfile()
+
+def add_zsh_system_dir_to_fpath_for_user():
+ if "zsh" not in os.environ.get("SHELL", ""):
+ return
+ try:
+ zsh_system_dir = get_zsh_system_dir()
+ fpath_output = subprocess.check_output([os.environ["SHELL"], "-c", 'printf "%s\n" "${fpath[@]}"'])
+ for fpath in fpath_output.decode().splitlines():
+ if fpath == zsh_system_dir:
+ return
+ link_zsh_user_rcfile(zsh_fpath=zsh_system_dir)
+ except (FileNotFoundError, subprocess.CalledProcessError):
+ pass
+
def main():
global args
args = parser.parse_args()
@@ -160,6 +177,8 @@ def main():
for destination in destinations:
install_to_destination(destination)
+ add_zsh_system_dir_to_fpath_for_user()
+
if args.dest is None:
print("Please restart your shell or source the installed file to activate it.", file=sys.stderr)
diff --git a/contrib/python/argcomplete/py3/argcomplete/shell_integration.py b/contrib/python/argcomplete/py3/argcomplete/shell_integration.py
index 37b5603b11f..cac48902fa7 100644
--- a/contrib/python/argcomplete/py3/argcomplete/shell_integration.py
+++ b/contrib/python/argcomplete/py3/argcomplete/shell_integration.py
@@ -166,7 +166,8 @@ def shellcode(executables, use_defaults=True, shell="bash", complete_arguments=N
executables_list = " ".join(quoted_executables)
script = argcomplete_script
if script:
- function_suffix = "_" + script
+ # If the script path contain a space, this would generate an invalid function name.
+ function_suffix = "_" + script.replace(" ", "_SPACE_")
else:
script = ""
function_suffix = ""
diff --git a/contrib/python/argcomplete/py3/ya.make b/contrib/python/argcomplete/py3/ya.make
index 74c56296586..327bc4e34ed 100644
--- a/contrib/python/argcomplete/py3/ya.make
+++ b/contrib/python/argcomplete/py3/ya.make
@@ -2,7 +2,7 @@
PY3_LIBRARY()
-VERSION(3.6.0)
+VERSION(3.6.1)
LICENSE(Apache-2.0)