modified install and uninstall command

This commit is contained in:
Yuta
2011-04-17 20:48:48 +09:00
parent c8779d0322
commit 9393b66448
8 changed files with 48 additions and 26 deletions
+11 -10
View File
@@ -1,5 +1,4 @@
import os
import sys
from pythonbrew.basecommand import Command
from pythonbrew.define import PATH_PYTHONS
from pythonbrew.util import off, rm_r, Package, get_current_python_path
@@ -12,15 +11,17 @@ class UninstallCommand(Command):
def run_command(self, options, args):
if args:
pkg = Package(args[0])
pkgname = pkg.name
pkgpath = os.path.join(PATH_PYTHONS, pkgname)
if not os.path.isdir(pkgpath):
logger.info("`%s` is not installed." % pkgname)
sys.exit(1)
if get_current_python_path() == os.path.join(pkgpath,'bin','python'):
off()
rm_r(pkgpath)
# Uninstall pythons
for arg in args:
pkg = Package(arg)
pkgname = pkg.name
pkgpath = os.path.join(PATH_PYTHONS, pkgname)
if not os.path.isdir(pkgpath):
logger.info("`%s` is not installed." % pkgname)
continue
if get_current_python_path() == os.path.join(pkgpath,'bin','python'):
off()
rm_r(pkgpath)
else:
self.parser.print_help()