update pip for choosing which python
This commit is contained in:
parent
2dffeaa1b9
commit
4a2cdf9f16
1 changed files with 21 additions and 12 deletions
|
|
@ -5,15 +5,15 @@ import sys
|
|||
import os
|
||||
import logging
|
||||
|
||||
from .utils import virtualenv_source, virtualenv
|
||||
from .utils import print_console, printerr
|
||||
from utils import virtualenv_source, virtualenv
|
||||
from utils import print_console, printerr
|
||||
|
||||
ERROR_BAD_BRANCH_PARAM = -3
|
||||
ERROR_BAD_PARAM = -2
|
||||
|
||||
|
||||
@task
|
||||
def setup_virtualenv():
|
||||
def setup_virtualenv(python3=False):
|
||||
configuration = env.config
|
||||
|
||||
if env.debug:
|
||||
|
|
@ -21,11 +21,18 @@ def setup_virtualenv():
|
|||
format='\n%(levelname)s: deploy.setup_virtualenv %(message)s',
|
||||
level=logging.DEBUG)
|
||||
|
||||
mkvirtualenv_cmd = "mkvirtualenv --no-site-packages " \
|
||||
"--python=`which python3` {virtualenv_name}".format(
|
||||
virtualenv_name=configuration.virtualenv.name)
|
||||
mkvirtualenv_cmd = "mkvirtualenv --no-site-packages "
|
||||
|
||||
if python3:
|
||||
mkvirtualenv_cmd += "--python=python3 "
|
||||
|
||||
mkvirtualenv_cmd += "{virtualenv_name}".format(
|
||||
virtualenv_name=configuration.virtualenv.name)
|
||||
|
||||
if env.debug:
|
||||
|
||||
logging.debug("python3 install: %s" % python3)
|
||||
|
||||
logging.debug("virtualenv.workon : %s"
|
||||
% configuration.virtualenv.workon)
|
||||
|
||||
|
|
@ -41,6 +48,8 @@ def setup_virtualenv():
|
|||
logging.debug("virtualenv.paths.root : %s"
|
||||
% configuration.virtualenv.paths.root)
|
||||
|
||||
logging.debug("mkvirtualenv_cmd: %s" % mkvirtualenv_cmd)
|
||||
|
||||
logging.debug("with virtualenv_source(): run(\"\n\t%s\n\t\")".format(
|
||||
mkvirtualenv_cmd))
|
||||
else:
|
||||
|
|
@ -147,7 +156,7 @@ def freeze(param='help'):
|
|||
\tFalse (default) - print the freeze output to the console
|
||||
"""
|
||||
|
||||
from .utils import booleanize, handle_help
|
||||
from utils import booleanize, handle_help
|
||||
|
||||
if handle_help(param, msg_help, 'help'):
|
||||
sys.exit()
|
||||
|
|
@ -209,7 +218,7 @@ def copyto(branch):
|
|||
"This will simply copy over \n\tthe requirements file for "
|
||||
"this branch with itself", ERROR_BAD_BRANCH_PARAM)
|
||||
|
||||
from .initialize import get_config
|
||||
from initialize import get_config
|
||||
|
||||
branch_config = get_config(branch)
|
||||
|
||||
|
|
@ -221,17 +230,17 @@ def copyto(branch):
|
|||
configuration.virtualenv.requirements.local,
|
||||
branch_config.virtualenv.requirements.filename)
|
||||
|
||||
print("current_local_path: %s" % current_local_path)
|
||||
print("branch_local_path: %s" % branch_local_path)
|
||||
print "current_local_path: %s" % current_local_path
|
||||
print "branch_local_path: %s" % branch_local_path
|
||||
|
||||
message = "Copying file from current branch '{branch_src}' to " \
|
||||
"destination branch '{branch_dst}'. Continue? Y/n ".format(
|
||||
branch_src=configuration.project.branch, branch_dst=branch)
|
||||
|
||||
from .utils import prompt_continue
|
||||
from utils import prompt_continue
|
||||
prompt_continue(message=message)
|
||||
|
||||
from .utils import upload_template
|
||||
from utils import upload_template
|
||||
upload_template(
|
||||
filename=configuration.virtualenv.requirements.filename,
|
||||
destination=branch_local_path,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue