kislyuk / argcomplete

Python and tab completion, better together.
https://kislyuk.github.io/argcomplete/
Apache License 2.0
1.39k stars 129 forks source link

Missing /etc/bash_completion.d causes bad Linux install #430

Closed flu0r1ne closed 1 year ago

flu0r1ne commented 1 year ago

I've observed an issue where the absence of /etc/bash_completion.d, which can occasionally occur on Linux systems, causes argcomplete's global activation script to default to /usr/local/etc/bash_completion.d. As per my understanding, this is the default location on OSX. However, this results in the completion script being placed in /usr/local/etc/bash_completion.d on Linux systems. This location is not sourced by bash-completion.

Argcomplete: f3f856bca9a1fc088df1f1b28fb4f3f4f5660916 (most recent)

Steps to reproduce:

$ mv /etc/bash_completion.d /tmp/bash_completion.d
$ ./activate-global-python-argcomplete
Installing /usr/lib/python3.11/site-packages/argcomplete/bash_completion.d/python-argcomplete to /usr/local/share/zsh/site-functions/_python-argcomplete...
Installed.
Installing /usr/lib/python3.11/site-packages/argcomplete/bash_completion.d/python-argcomplete to /usr/local/etc/bash_completion.d/python-argcomplete...
Installed.
Please restart your shell or source the installed file to activate it.
flu0r1ne commented 1 year ago

Fix #431:

Tested on Linux not OSX.