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

Support python3 executable when python is not available #10469

Closed
mcornella opened this issue Dec 1, 2021 · 7 comments · Fixed by #10832
Closed

Support python3 executable when python is not available #10469

mcornella opened this issue Dec 1, 2021 · 7 comments · Fixed by #10832
Assignees
Labels
Area: core Issue or PR related to core parts of the project Feature New feature or request Good first issue Good for newcomers

Comments

@mcornella
Copy link
Member

mcornella commented Dec 1, 2021

Many systems don't link python to python3. Debian even maintains it's wrong for their packages to expect python to work:

NOTE: Debian testing (bullseye) has removed the "python" package and the '/usr/bin/python' symlink due to the deprecation of Python 2. No packaged scripts should depend on the existence of '/usr/bin/python': if they do, that is a bug that should be reported to Debian. You can use the 'python-is-python3' or 'python-is-python2' packages to restore an appropriate '/usr/bin/python' symlink for third-party or legacy scripts.

Therefore we should support both python and python3. This can be done from Zsh with the form

${commands[python]:-python3}

but the use in file shebangs is harder to do.

It should be researched whether python3 is expected to be available in all systems, so we can just rename all python uses to python3, or if either command can be available in different systems.

Reference: #10466


Used in plugins:

  • aliases
  • django
  • git-prompt
  • jsontools
  • python
  • shell-proxy (as python3)
  • urltools (as python2 or python3)
@mcornella mcornella added Bug Something isn't working Area: core Issue or PR related to core parts of the project Good first issue Good for newcomers labels Dec 1, 2021
@mcornella mcornella added Feature New feature or request and removed Bug Something isn't working labels Dec 29, 2021
@carlosala
Copy link
Member

I think that renaming every usage from python to python3 is counterproductive. Python2 is deprecated since 2 years ago, so it's a matter of time for the command python be default in every distro/OS. We can discuss about it, I don't see an easy solution for this issue.

@tkomane
Copy link

tkomane commented Mar 9, 2022

I think that renaming every usage from python to python3 is counterproductive. Python2 is deprecated since 2 years ago, so it's a matter of time for the command python be default in every distro/OS. We can discuss about it, I don't see an easy solution for this issue.

Just dealt with this issue and I'm inclined to agree with this. In the interim it might make more sense to recommend installation of 'python-is-python3' or 'python-is-python2' packages - and maybe even prompt the installation as a fallback within the respective plugin zsh scripts, (whenever a python executable can't be detected).

@carlosala
Copy link
Member

I agree with you! Maybe we can spawn a warning if python is missing but python3 is there. By the way, I don't really know if every system that doesn't link python with python3 has those packages.

@mcornella
Copy link
Member Author

I think the solution is to rename everything to python3, as stated in #10777 (comment).

@mcornella
Copy link
Member Author

@carlosala can you take care of renaming every call to python for python3? Judging from the comments, that seems like the safest bet.

@carlosala
Copy link
Member

Yes, I planned to do it last week but many things came up😅
I'll do it before Sunday!

@mcornella
Copy link
Member Author

Awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: core Issue or PR related to core parts of the project Feature New feature or request Good first issue Good for newcomers
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants