2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-11 15:51:03 +00:00

Merge pull request #567 from netchampfaris/fix-exec-py

fix path executable to python3
This commit is contained in:
Achilles Rasquinha 2018-02-07 15:58:22 +05:30 committed by GitHub
commit 4d271e436e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View File

@ -83,7 +83,7 @@ from bench.commands.install import install
bench_command.add_command(install) bench_command.add_command(install)
@click.command('migrate-env') @click.command('migrate-env')
@click.argument('python', type = click.Choice(['python2', 'python3'])) @click.argument('python', type = str)
@click.option('--no-backup', default = False, help = 'Do not backup the existing Virtual Environment') @click.option('--no-backup', default = False, help = 'Do not backup the existing Virtual Environment')
def migrate_env(python, no_backup = False): def migrate_env(python, no_backup = False):
""" """
@ -99,7 +99,7 @@ def migrate_env(python, no_backup = False):
parch = osp.join(path, 'archived_envs') parch = osp.join(path, 'archived_envs')
if not osp.exists(parch): if not osp.exists(parch):
os.mkdir(parch) os.mkdir(parch)
# Simply moving. Thanks, Ameya. # Simply moving. Thanks, Ameya.
# I'm keen to zip. # I'm keen to zip.
source = osp.join(path, 'env') source = osp.join(path, 'env')
@ -108,18 +108,18 @@ def migrate_env(python, no_backup = False):
log.debug('Backing up Virtual Environment') log.debug('Backing up Virtual Environment')
stamp = datetime.now().strftime('%Y%m%d_%H%M%S') stamp = datetime.now().strftime('%Y%m%d_%H%M%S')
dest = osp.join(path, str(stamp)) dest = osp.join(path, str(stamp))
# WARNING: This is an archive, you might have to use virtualenv --relocate # WARNING: This is an archive, you might have to use virtualenv --relocate
# That's because virtualenv creates symlinks with shebangs pointing to executables. # That's because virtualenv creates symlinks with shebangs pointing to executables.
# ...and shutil.copytree is a f*cking mess. # ...and shutil.copytree is a f*cking mess.
os.rename(source, dest) os.rename(source, dest)
shutil.move(dest, target) shutil.move(dest, target)
log.debug('Setting up a New Virtual {python} Environment'.format( log.debug('Setting up a New Virtual {python} Environment'.format(
python = python python = python
)) ))
# Path to Python Executable (Basically $PYTHONPTH) # Path to Python Executable (Basically $PYTHONPTH)
python = which(python) python = which(python)

View File

@ -2,7 +2,7 @@ import click
@click.command() @click.command()
@click.argument('path') @click.argument('path')
@click.option('--python', type = click.Choice(['python2', 'python3']), default = 'python2', help = 'Path to Python Executable.') @click.option('--python', type = str, default = 'python2', help = 'Path to Python Executable.')
@click.option('--ignore-exist', is_flag = True, default = False, help = "Ignore if Bench instance exists.") @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('--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") @click.option('--frappe-path', default=None, help="path to frappe repo")