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

Switch to Python 3 #3970

Closed
paride opened this issue Apr 20, 2017 · 1 comment
Closed

Switch to Python 3 #3970

paride opened this issue Apr 20, 2017 · 1 comment

Comments

@paride
Copy link

paride commented Apr 20, 2017

On newer systems (e.g., Debian stretch) no Python 2 flavor is installed by default, only Python 3 is. This means that the three Python scripts

/usr/share/fish/tools/deroff.py
/usr/share/fish/tools/create_manpage_completions.py
/usr/share/fish/tools/web_config/webconfig.py

fail to run, as the shebang looks for python and not for python3. I think it's time to switch to python3. It has to be noted that https://www.python.org/dev/peps/pep-0394/ recommends that the python binary (or symlink) refer to some version of Python 2.x, and never to Python 3.x.

If the scripts support both Python 2 and 3, a trick like http://stackoverflow.com/a/26056481 could be used.

I'm running fish 2.5.0-314-g7c66008.

@faho
Copy link
Member

faho commented Apr 20, 2017

If the scripts support both Python 2 and 3

Yes, they do.

a trick like http://stackoverflow.com/a/26056481 could be used.

Wow, that's amazing! Unfortunately, I don't think we want to rely on /bin/sh here and this won't work with fish script since IIUC we scan the entire file before execution (there'll be an invalid command name as soon as you have a function() call without a space between the function name and the parentheses). Also, it is a bit hacky.

What we should do (and already do in __fish_config_interactive) is to change the fish functions that call these thing. You're not expected to call these directly anyway, since they need a bit of setup.

Of these, deroff is basically a library and only ever imported, so it doesn't need a change.

@faho faho added this to the 2.6.0 milestone Apr 20, 2017
faho added a commit to faho/fish-shell that referenced this issue Apr 20, 2017
This removes a need for packagers to either patch our shebangs or pick
a particular python.

This was already done in __fish_config_interactive (where we need to
duplicate the code because it involves backgrounding).

Work towards fish-shell#3970.
faho added a commit to faho/fish-shell that referenced this issue Apr 20, 2017
Also remove a use of `eval` and `string escape`.

Fixes fish-shell#3970.
@faho faho mentioned this issue Apr 20, 2017
1 task
faho added a commit that referenced this issue Apr 21, 2017
This removes a need for packagers to either patch our shebangs or pick
a particular python.

This was already done in __fish_config_interactive (where we need to
duplicate the code because it involves backgrounding).

Work towards #3970.
@faho faho closed this as completed in e410d47 Apr 21, 2017
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants