mirror of
https://github.com/frappe/bench.git
synced 2024-11-11 15:51:03 +00:00
[fix] update setuptools and pip before creating virtual env and use system default python
This commit is contained in:
parent
cfe169ab4b
commit
8876a40175
@ -135,6 +135,9 @@ def migrate_env(python, no_backup = False):
|
||||
pvenv = pvenv
|
||||
), cwd = path)
|
||||
|
||||
pip = osp.join(pvenv, 'bin', 'pip')
|
||||
exec_cmd('{pip} install --upgrade pip'.format(pip=pip))
|
||||
exec_cmd('{pip} install --upgrade setuptools'.format(pip=pip))
|
||||
# TODO: Options
|
||||
|
||||
papps = osp.join(path, 'apps')
|
||||
@ -143,7 +146,6 @@ def migrate_env(python, no_backup = False):
|
||||
for app in apps:
|
||||
papp = osp.join(papps, app)
|
||||
if osp.isdir(papp) and osp.exists(osp.join(papp, 'setup.py')):
|
||||
pip = osp.join(pvenv, 'bin', 'pip')
|
||||
exec_cmd('{pip} install -e {app}'.format(
|
||||
pip = pip, app = papp
|
||||
))
|
||||
|
@ -2,7 +2,7 @@ import click
|
||||
|
||||
@click.command()
|
||||
@click.argument('path')
|
||||
@click.option('--python', type = str, default = 'python2', help = 'Path to Python Executable.')
|
||||
@click.option('--python', type = str, default = 'python', help = 'Path to Python Executable.')
|
||||
@click.option('--ignore-exist', is_flag = True, default = False, help = "Ignore if Bench instance exists.")
|
||||
@click.option('--apps_path', default=None, help="path to json files with apps to install after init")
|
||||
@click.option('--frappe-path', default=None, help="path to frappe repo")
|
||||
@ -16,7 +16,7 @@ import click
|
||||
def init(path, apps_path, frappe_path, frappe_branch, no_procfile, no_backups,
|
||||
no_auto_update, clone_from, verbose, skip_redis_config_generation,
|
||||
ignore_exist = False,
|
||||
python = 'python2'): # Let's change we're ready. - <achilles@frappe.io>
|
||||
python = 'python'): # Let's change we're ready. - <achilles@frappe.io>
|
||||
'''
|
||||
Create a New Bench Instance.
|
||||
'''
|
||||
|
@ -68,10 +68,11 @@ def setup_backups():
|
||||
setup_backups()
|
||||
|
||||
@click.command('env')
|
||||
def setup_env():
|
||||
@click.option('--python', type = str, default = 'python', help = 'Path to Python Executable.')
|
||||
def setup_env(python='python'):
|
||||
"Setup virtualenv for bench"
|
||||
from bench.utils import setup_env
|
||||
setup_env()
|
||||
setup_env(python=python)
|
||||
|
||||
@click.command('firewall')
|
||||
@click.option('--ssh_port')
|
||||
|
@ -29,7 +29,7 @@ def init(path, apps_path=None, no_procfile=False, no_backups=False,
|
||||
no_auto_update=False, frappe_path=None, frappe_branch=None, wheel_cache_dir=None,
|
||||
verbose=False, clone_from=None, skip_redis_config_generation=False,
|
||||
ignore_exist = False,
|
||||
python = 'python2'): # Let's change when we're ready. - <achilles@frappe.io>
|
||||
python = 'python'): # Let's change when we're ready. - <achilles@frappe.io>
|
||||
from .app import get_app, install_apps_from_path
|
||||
from .config.common_site_config import make_config
|
||||
from .config import redis
|
||||
@ -152,7 +152,7 @@ def which(executable, raise_err = False):
|
||||
|
||||
return exec_
|
||||
|
||||
def setup_env(bench_path='.', python = 'python2'):
|
||||
def setup_env(bench_path='.', python = 'python'):
|
||||
python = which(python, raise_err = True)
|
||||
|
||||
exec_cmd('virtualenv -q {} -p {}'.format('env', python), cwd=bench_path)
|
||||
|
Loading…
Reference in New Issue
Block a user