Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update bash-completion support #804

Open
EricBelanger opened this issue Apr 26, 2013 · 8 comments · May be fixed by #22355
Open

Update bash-completion support #804

EricBelanger opened this issue Apr 26, 2013 · 8 comments · May be fixed by #22355

Comments

@EricBelanger
Copy link

@EricBelanger EricBelanger commented Apr 26, 2013

Since bash-completion 1.90 (released in Nov 2011), there has been a layout change: everything is now in /usr/share/bash-completion/, rather than in /etc/. Also, the completion must have the same name as the binary.

Therefore, the completion should now be installed as:
/usr/share/bash-completion/completions/youtube-dl

Thanks

@phihag
Copy link
Contributor

@phihag phihag commented Nov 22, 2013

Mmm, I'm not sure how to rename the file in setup.py - we already have a binary youtube-dl.

@EricBelanger
Copy link
Author

@EricBelanger EricBelanger commented Nov 23, 2013

I have no idea how this setup.py stuff works. The only thing I can think of, which works, is to put the file in a sub-directory (maybe naming it completions) so it wouldn't conflict with the binary in the main directory..

@FiloSottile
Copy link
Collaborator

@FiloSottile FiloSottile commented Nov 23, 2013

What are the permissions on that folder? Because I'm not that fond of making ytdl only installable via sudo.
Or, is there a user bash-completion folder?

@FiloSottile
Copy link
Collaborator

@FiloSottile FiloSottile commented Nov 23, 2013

What is the adoption for this new version? On my box I'm still in etc

filosottile@li593-45:~$ ls /usr/share/bash-completion/
ls: cannot access /usr/share/bash-completion/: No such file or directory
filosottile@li593-45:~$ sudo apt-get install bash-completion
[sudo] password for filosottile:
Reading package lists... Done
Building dependency tree
Reading state information... Done
bash-completion is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 13 not upgraded.
filosottile@li593-45:~$ ls /etc/bash
bash.bashrc        bash_completion    bash_completion.d/
filosottile@li593-45:~$ ls /etc/bash_completion.d/
abook              autorpm        chkconfig   cups
...
@EricBelanger
Copy link
Author

@EricBelanger EricBelanger commented Nov 23, 2013

The /usr/share/bash-completion/ folder is 755 for root. I believe it's also the case for the old location (/etc/bash_completion.d) so it won't be affected by this change.

BTW, according to the FAQ in the README, you can put completions in ~/.bash_completion, which is parsed at the end of the main completion script.

As I said in my initial post, the layout change was done in bash-completion 1.90. The current version is 2.1 although the source tarball seems to have disappearedfrom alioth.debian.org. You're probaly still using an old version.

@FiloSottile
Copy link
Collaborator

@FiloSottile FiloSottile commented Nov 23, 2013

Ok, my two points are that first, if a large chunk of users are still
on the old system because i.e. of their distribution, we should
consider that. Second, when I noticed this permission problem, I set
all files to be installed relative to the package install folder (see
"data_files" in setup.py).

Actually, I thought that that approach was broken (maybe for
everything else than manpages, I don't remember), but I don't have a
better one. Are the current bash-completions working as installed with
the old system?

Filippo Valsorda

2013/11/22 EricBelanger notifications@github.com:

The /usr/share/bash-completion/ folder is 755 for root. I believe it's also
the case for the old location (/etc/bash_completion.d) so it won't be
affected by this change.

BTW, according to the FAQ in the README, you can put completions in
~/.bash_completion, which is parsed at the end of the main completion
script.

As I said in my initial post, the layout change was done in bash-completion
1.90. The current version is 2.1 although the source tarball seems to have
disappearedfrom alioth.debian.org. You're probaly still using an old
version.


Reply to this email directly or view it on GitHub.

@EricBelanger
Copy link
Author

@EricBelanger EricBelanger commented Nov 24, 2013

As 1.9 was released 2 years ago and the stable 2.0 was released 17 months ago, I thought most distro would be using the bash-completion with the new layout. I seems that it's not the case (I presume you are using Debian). The new bash-completion has a compatibility mode where it also look in /etc/bash_completion.d for for completions so the current installation of the youtube-dl completion works with the newer versions. Therefore, you can keep this bug open as a reminder and wait for either wider usage of the new bash-completion layout or until that compat mode is removed (if that happens) before before changing the current behavior.

The location change consist of just replacing etc/bash_completion.d by share/bash-completion/completions in setup.py. So the completion will be in the same 'share' directory tree as the man page and README.txt file so the use of sudo won't be necessarry if the installation is done in a non-system directory.

@sorbits
Copy link

@sorbits sorbits commented Sep 10, 2019

I think wide adoption of bash-completion 1.90+ can now be assumed.

I actually came here wanting to make a PR, but I just can’t figure out how to test python setuptools locally, and as pointed out above, the completion file must now be named youtube-dl so either setup.py should include the target name as well, or the source file needs to go into a subdirectory to avoid the name clash.

Update: For local install I used pip install --user . (originally I had tried --install-option="--prefix=/tmp/local" and --target but neither of that worked). I have now submitted a PR with proper install location.

@sorbits sorbits linked a pull request that will close this issue Sep 10, 2019
2 of 6 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants
You can’t perform that action at this time.