2019-03-09 16:57:49 +00:00
|
|
|
function __fish_anypython
|
|
|
|
# Try python3 first, because that's usually faster and generally nicer.
|
2022-12-26 21:40:13 +00:00
|
|
|
# Do not consider the stub /usr/bin/python3 that comes installed on Darwin to be Python
|
|
|
|
# unless Xcode reports a real directory path.
|
2020-05-10 20:46:22 +00:00
|
|
|
for py in python3 python3.{9,8,7,6,5,4,3} python2 python2.7 python
|
2022-12-26 21:40:13 +00:00
|
|
|
if set -l py_path (command -s $py)
|
|
|
|
if string match -q /usr/bin/python3 -- $py_path
|
|
|
|
and string match -q Darwin -- "$(uname)"
|
|
|
|
and type -q xcode-select
|
|
|
|
and not xcode-select --print-path &>/dev/null
|
|
|
|
continue
|
|
|
|
end
|
|
|
|
echo $py
|
|
|
|
return 0
|
|
|
|
end
|
2019-03-09 16:57:49 +00:00
|
|
|
end
|
|
|
|
# We have no python.
|
|
|
|
return 1
|
|
|
|
end
|