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

Comments

Projects
None yet
2 participants
@paride

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

This comment has been minimized.

Show comment
Hide comment
@faho

faho Apr 20, 2017

Member

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.

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 the enhancement label Apr 20, 2017

@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

fish_update_completions: Pick a python
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 added a commit to faho/fish-shell that referenced this issue Apr 20, 2017

fish_config: Pick a python
Also remove a use of `eval` and `string escape`.

Fixes #3970.

@faho faho referenced this issue Apr 20, 2017

Merged

Just pick a python #3971

1 of 1 task complete

faho added a commit that referenced this issue Apr 21, 2017

fish_update_completions: Pick a python
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 in e410d47 Apr 21, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment