From a7ef06f6aebdaa0bcded3fe6405f058d62bea5b9 Mon Sep 17 00:00:00 2001 From: utahta Date: Mon, 22 Nov 2010 02:04:16 +0900 Subject: [PATCH] fixed installed command. --- pythonbrew/commands/installed.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pythonbrew/commands/installed.py b/pythonbrew/commands/installed.py index 9a858ea..b8ba035 100644 --- a/pythonbrew/commands/installed.py +++ b/pythonbrew/commands/installed.py @@ -1,8 +1,9 @@ import os +import sys +from subprocess import Popen, PIPE from pythonbrew.basecommand import Command from pythonbrew.define import PATH_PYTHONS from pythonbrew.log import logger -import sys class InstalledCommand(Command): name = "installed" @@ -10,10 +11,12 @@ class InstalledCommand(Command): summary = "List the installed versions of python" def run_command(self, options, args): - cur = "" - + cur = None if not os.path.islink("%s/current" % PATH_PYTHONS): - logger.info("%s (*)" % sys.executable) + p = Popen('command -v python', stdout=PIPE, shell=True) + p.wait() + if p.returncode == 0: + logger.info("%s (*)" % p.stdout.read().strip()) elif os.path.islink("%s/current" % PATH_PYTHONS): cur = os.path.basename(os.path.realpath("%s/current" % PATH_PYTHONS)) for d in sorted(os.listdir("%s/" % PATH_PYTHONS)):