2023-01-12 11:19:50 -08:00
|
|
|
{{- if (ne .host.distro.family "windows") -}}
|
|
|
|
#!/usr/bin/env bash
|
2023-04-11 15:03:50 -07:00
|
|
|
# @file Python Symlink
|
2023-04-11 15:03:34 -07:00
|
|
|
# @brief Symlinks `python` to `python3` when Python 2.7 is not installed
|
|
|
|
# @description
|
|
|
|
# This script checks if `python3` is available and if `python` is not available. If both are true, then the script
|
|
|
|
# symlinks `python` to `python3` so that the `python` command uses `python3`.
|
|
|
|
#
|
|
|
|
# This is useful if you do not want to install Python 2.7 and would like Python 3 to be used in all cases.
|
2023-01-12 11:19:50 -08:00
|
|
|
|
|
|
|
{{ includeTemplate "universal/profile" }}
|
|
|
|
{{ includeTemplate "universal/logg" }}
|
|
|
|
|
|
|
|
### Symlink python3 to python if it is unavailable
|
|
|
|
if ! command -v python > /dev/null && command -v python3 > /dev/null; then
|
|
|
|
logg info 'Symlinking `python3` to `python` since the latter is unavailable'
|
|
|
|
sudo ln -s "$(which python3)" /usr/local/bin/python
|
|
|
|
fi
|
|
|
|
|
|
|
|
{{ end -}}
|