0818df057cca59a949ffa88947a6b16dec2411ca

Author
Carlo Sala <carlosalag@protonmail.com>
Committer
GitHub <noreply@github.com>
Date

Message

fix: use `python3` for all `python` invocations (#10832)

Diff

  1diff --git a/plugins/aliases/aliases.plugin.zsh b/plugins/aliases/aliases.plugin.zsh
  2index b3d9340f08db6e1942e8fd669dbf4847b22d5b88..4e1e0558ecaf4c6a91a8bde1319d9011b0353701 100644
  3--- a/plugins/aliases/aliases.plugin.zsh
  4+++ b/plugins/aliases/aliases.plugin.zsh
  5@@ -3,9 +3,9 @@
  6 # - acs: alias cheatsheet
  7 #   group alias by command, pass addition argv to grep.
  8 function acs(){
  9-  (( $+commands[python] )) || {
 10+  (( $+commands[python3] )) || {
 11     echo "[error] No python executable detected"
 12     return
 13   }
 14-  alias | python ${functions_source[$0]:h}/cheatsheet.py $@
 15+  alias | python3 ${functions_source[$0]:h}/cheatsheet.py $@
 16 }
 17diff --git a/plugins/aliases/cheatsheet.py b/plugins/aliases/cheatsheet.py
 18index 694afd31c6e31c9e83c77e49cab6f5e9b62b9a36..a7e3968b0e2e3cdef90ec47f285015c748db11f8 100644
 19--- a/plugins/aliases/cheatsheet.py
 20+++ b/plugins/aliases/cheatsheet.py
 21@@ -1,4 +1,4 @@
 22-#!/usr/bin/env python
 23+#!/usr/bin/env python3
 24 import sys
 25 import itertools
 26 import termcolor
 27diff --git a/plugins/git-prompt/README.md b/plugins/git-prompt/README.md
 28index 83d365c84f02ae03258f894ed23c7678ccb18669..8775af89336973e208329d68d8db32b97cf6e29b 100644
 29--- a/plugins/git-prompt/README.md
 30+++ b/plugins/git-prompt/README.md
 31@@ -13,7 +13,7 @@ See the [original repository](https://github.com/olivierverdier/zsh-git-prompt).
 32 
 33 ## Requirements
 34 
 35-This plugin uses `python`, so your host needs to have it installed
 36+This plugin uses `python3`, so your host needs to have it installed.
 37 
 38 ## Examples
 39 
 40diff --git a/plugins/git-prompt/git-prompt.plugin.zsh b/plugins/git-prompt/git-prompt.plugin.zsh
 41index c86c1f59b645e1eef0077e546dee7232b50f310b..0485e317cfcb4a648f36d9d1cf3b6603aab4f5b2 100644
 42--- a/plugins/git-prompt/git-prompt.plugin.zsh
 43+++ b/plugins/git-prompt/git-prompt.plugin.zsh
 44@@ -36,7 +36,7 @@ function update_current_git_vars() {
 45     unset __CURRENT_GIT_STATUS
 46 
 47     local gitstatus="$__GIT_PROMPT_DIR/gitstatus.py"
 48-    _GIT_STATUS=$(python ${gitstatus} 2>/dev/null)
 49+    _GIT_STATUS=$(python3 ${gitstatus} 2>/dev/null)
 50      __CURRENT_GIT_STATUS=("${(@s: :)_GIT_STATUS}")
 51     GIT_BRANCH=$__CURRENT_GIT_STATUS[1]
 52     GIT_AHEAD=$__CURRENT_GIT_STATUS[2]
 53diff --git a/plugins/git-prompt/gitstatus.py b/plugins/git-prompt/gitstatus.py
 54index 4dea8000f19e5eb0c494d25d5e44cfd1a1d7b740..b5c3c9a0c9fdcaeddcb0c64d897737ea003da8b6 100644
 55--- a/plugins/git-prompt/gitstatus.py
 56+++ b/plugins/git-prompt/gitstatus.py
 57@@ -1,4 +1,4 @@
 58-#!/usr/bin/env python
 59+#!/usr/bin/env python3
 60 from __future__ import print_function
 61 
 62 import os
 63diff --git a/plugins/jsontools/jsontools.plugin.zsh b/plugins/jsontools/jsontools.plugin.zsh
 64index 857ca0ec9946a061c3c4f5fe9a94b03ea3223e32..49828d32d2ecc9394eedf4f4150a287d6280678d 100644
 65--- a/plugins/jsontools/jsontools.plugin.zsh
 66+++ b/plugins/jsontools/jsontools.plugin.zsh
 67@@ -8,7 +8,7 @@ fi
 68 
 69 # If method undefined, find the first one that is installed
 70 if [[ -z "$JSONTOOLS_METHOD" ]]; then
 71-  for JSONTOOLS_METHOD in node python ruby; do
 72+  for JSONTOOLS_METHOD in node python3 ruby; do
 73     # If method found, break out of loop
 74     (( $+commands[$JSONTOOLS_METHOD] )) && break
 75     # Otherwise unset the variable
 76@@ -45,12 +45,12 @@ case "$JSONTOOLS_METHOD" in
 77       xargs -0 node -e "console.log(decodeURIComponent(process.argv[1]))"
 78     }
 79   ;;
 80-  python)
 81+  python3)
 82     function pp_json() {
 83-      python -c 'import sys; del sys.path[0]; import runpy; runpy._run_module_as_main("json.tool")'
 84+      python3 -c 'import sys; del sys.path[0]; import runpy; runpy._run_module_as_main("json.tool")'
 85     }
 86     function is_json() {
 87-      python -c '
 88+      python3 -c '
 89 import sys; del sys.path[0];
 90 import json
 91 try:
 92@@ -61,14 +61,14 @@ except ValueError:
 93       '
 94     }
 95     function urlencode_json() {
 96-      python -c '
 97+      python3 -c '
 98 import sys; del sys.path[0];
 99 from urllib.parse import quote_plus
100 print(quote_plus(sys.stdin.read()))
101       '
102     }
103     function urldecode_json() {
104-      python -c '
105+      python3 -c '
106 import sys; del sys.path[0];
107 from urllib.parse import unquote_plus
108 print(unquote_plus(sys.stdin.read()))
109diff --git a/plugins/pyenv/pyenv.plugin.zsh b/plugins/pyenv/pyenv.plugin.zsh
110index ebb1a708acfc55398d8392b2e41356d20164abe6..7fbd1589ea77c05f6d795043bbe3456782ab2ada 100644
111--- a/plugins/pyenv/pyenv.plugin.zsh
112+++ b/plugins/pyenv/pyenv.plugin.zsh
113@@ -89,7 +89,7 @@ if [[ $FOUND_PYENV -eq 1 ]]; then
114 else
115   # Fall back to system python
116   function pyenv_prompt_info() {
117-    local version="$(python -V 2>&1 | cut -d' ' -f2)"
118+    local version="$(python3 -V 2>&1 | cut -d' ' -f2)"
119     echo "system: ${version:gs/%/%%}"
120   }
121 fi
122diff --git a/plugins/python/README.md b/plugins/python/README.md
123index c1f0adef8bafd3ac281db8d7ba0654cabadf7d45..97c1a34ee66e97c5e04d925bd618196523f5813d 100644
124--- a/plugins/python/README.md
125+++ b/plugins/python/README.md
126@@ -12,7 +12,7 @@ plugins=(... python)
127 
128 | Command          | Description                                                                            |
129 | ---------------- | -------------------------------------------------------------------------------------- |
130-| `py`             | Runs `python`                                                                          |
131+| `py`             | Runs `python3`                                                                         |
132 | `ipython`        | Runs the appropriate `ipython` version according to the activated virtualenv           |
133 | `pyfind`         | Finds .py files recursively in the current directory                                   |
134 | `pyclean [dirs]` | Deletes byte-code and cache files from a list of directories or the current one        |
135diff --git a/plugins/python/python.plugin.zsh b/plugins/python/python.plugin.zsh
136index 7a73ab92a7a47bfd7843067aeae0417bbef96c71..2fbb59577409caa7c89b8b68ced6d2243c0fa08d 100644
137--- a/plugins/python/python.plugin.zsh
138+++ b/plugins/python/python.plugin.zsh
139@@ -1,5 +1,5 @@
140 # python command
141-alias py='python'
142+alias py='python3'
143 
144 # Find python file
145 alias pyfind='find . -name "*.py"'
146@@ -44,10 +44,10 @@ function pyuserpaths() {
147 alias pygrep='grep -nr --include="*.py"'
148 
149 # Run proper IPython regarding current virtualenv (if any)
150-alias ipython="python -c 'import IPython; IPython.terminal.ipapp.launch_new_instance()'"
151+alias ipython="python3 -c 'import IPython; IPython.terminal.ipapp.launch_new_instance()'"
152 
153 # Share local directory as a HTTP server
154-alias pyserver="python -m http.server"
155+alias pyserver="python3 -m http.server"
156 
157 
158 ## venv utilities