Use current Python interpreter to show updated version

This commit is contained in:
Ivan Kravets
2016-01-13 22:22:55 +02:00
parent 2d42f944cd
commit 54f2f4ce45

View File

@ -35,8 +35,7 @@ def cli():
fg="yellow") fg="yellow")
cmds = ( cmds = (
[os.path.normpath(sys.executable), ["pip", "install", "--upgrade", "platformio"],
"-m", "pip", "install", "--upgrade", "platformio"],
["platformio", "--version"] ["platformio", "--version"]
) )
@ -44,11 +43,12 @@ def cli():
r = None r = None
try: try:
for cmd in cmds: for cmd in cmds:
cmd = [os.path.normpath(sys.executable), "-m"] + cmd
r = None r = None
r = util.exec_command(cmd) r = util.exec_command(cmd)
# try pip with disabled cache # try pip with disabled cache
if r['returncode'] != 0 and cmd[0] != "platformio": if r['returncode'] != 0 and cmd[2] == "pip":
cmd.insert(3, "--no-cache-dir") cmd.insert(3, "--no-cache-dir")
r = util.exec_command(cmd) r = util.exec_command(cmd)