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

Don't Install in /usr/share/.. #59

Open
psacawa opened this issue Jul 8, 2021 · 4 comments
Open

Don't Install in /usr/share/.. #59

psacawa opened this issue Jul 8, 2021 · 4 comments
Assignees
Milestone

Comments

@psacawa
Copy link

psacawa commented Jul 8, 2021

I've wanted zsh completions for pypi ecosystem for a long time, so I want to thank you for getting the ball rolling on this. My strong feeling, however, is that you shouldn't force the installation anywhere superuser privileges are required. Namely, find_completion_script_dir should prefer a user directory in fpath.

Completions for Python itself: _python are typically vendor-distributed, and therefore in /usr/share/zsh/functions/Completion/Unix. At least it's this way in Ubuntu Linux. For now I just trick it by writing a dummy file _python elsewhere.

@psacawa psacawa changed the title Don't Install in Root... Don't Install in /usr/share/.. Jul 8, 2021
@dan1994
Copy link
Owner

dan1994 commented Jul 10, 2021

Thanks for the feedback.

Honestly I would have really wanted to choose a user directory, but the thing is that there isn't always one.

I tried to check how fpath looks in a fresh zsh installation and I found it only contains paths under /usr/local and /usr/share, both of which are owned by root.

I could complicate my logic to try and find a user owned directory, and resort to the current situation as a fallback, but since I don't even know which user directory to choose I would have to guess, which may be both unwanted and unpredictable.

Another option is to update the fpath myself which requires editing the user's .zshrc, which I would also like to avoid.

The last option that comes to mind is to let the user pass in the path, which is pretty straightforward, but might still prove problematic if the user tries to upgrade and chooses a different directory (resulting in conflicting versions of the completion scripts).

I would love to hear your thoughts on these options.

@eaybek
Copy link

eaybek commented Jul 16, 2021

in such cases you can consider prepare a file and ask to user for source it. Just for an option

@dan1994 dan1994 added this to the Version 1.0.4 milestone Sep 16, 2021
@dan1994
Copy link
Owner

dan1994 commented Sep 16, 2021

Thank you for the suggestion, and sorry for the late reply.

I like your suggestion and can implement it quite easily. By default running the activate script will print out a line to add to .zshrc of the form fpath=$fpath /path/to/zsh/scripts and the user will copy it manually.

@dan1994
Copy link
Owner

dan1994 commented Sep 17, 2021

Hey @psacawa, @eaybek. I have opened a PR that attempts to improve this issue. If you have any time to take a look and tell me if this would be a good solution for you, I'd be grateful.

The main idea is that I don't copy the files anywhere and provide the user with a line to put in their .zshrc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants