From 4aa62201c7f13f1212911308d19236b1be6ef790 Mon Sep 17 00:00:00 2001 From: utahta Date: Thu, 21 Jul 2011 02:22:00 +0900 Subject: [PATCH] update venv command --- pythonbrew/commands/venv.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/pythonbrew/commands/venv.py b/pythonbrew/commands/venv.py index 9fb0ab7..25a0bce 100644 --- a/pythonbrew/commands/venv.py +++ b/pythonbrew/commands/venv.py @@ -32,22 +32,20 @@ class VenvCommand(Command): if options.python: pkgname = Package(options.python).name + if not is_installed(pkgname): + logger.error('%s is not installed.' % pkgname) + sys.exit(1) else: pkgname = get_using_python_pkgname() - if not is_installed(pkgname): - logger.error("%s is not installed." % pkgname) - sys.exit(1) + if not pkgname: + logger.error('Can not create virtual environment before using a python. Try \'pythonbrew install \'.') + sys.exit(1) pkg_dir = os.path.join(PATH_PYTHONS, pkgname) pkg_bin_dir = os.path.join(pkg_dir, 'bin') self._pkg_bin_dir = pkg_bin_dir self._venv_dir = os.path.join(PATH_VENVS, pkgname) - # check python package name - if not pkgname: - logger.error('Can not create virtual environment before using a python. Try \'pythonbrew switch \'.') - sys.exit(1) - # has virtualenv & virtualenvwrapper? if(not os.path.exists(os.path.join(pkg_bin_dir, 'virtualenvwrapper.sh')) or not os.path.exists(os.path.join(pkg_bin_dir, 'virtualenv'))):