From b5839dafebfd88dea22eb214fb1613535ab34b38 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Wed, 7 Feb 2018 15:55:28 +0530 Subject: [PATCH] fix path executable to python3 --- bench/commands/__init__.py | 12 ++++++------ bench/commands/make.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bench/commands/__init__.py b/bench/commands/__init__.py index 646b7f86..4eedad79 100755 --- a/bench/commands/__init__.py +++ b/bench/commands/__init__.py @@ -83,7 +83,7 @@ from bench.commands.install import install bench_command.add_command(install) @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') def migrate_env(python, no_backup = False): """ @@ -99,7 +99,7 @@ def migrate_env(python, no_backup = False): parch = osp.join(path, 'archived_envs') if not osp.exists(parch): os.mkdir(parch) - + # Simply moving. Thanks, Ameya. # I'm keen to zip. source = osp.join(path, 'env') @@ -108,18 +108,18 @@ def migrate_env(python, no_backup = False): log.debug('Backing up Virtual Environment') stamp = datetime.now().strftime('%Y%m%d_%H%M%S') dest = osp.join(path, str(stamp)) - + # WARNING: This is an archive, you might have to use virtualenv --relocate # That's because virtualenv creates symlinks with shebangs pointing to executables. - + # ...and shutil.copytree is a f*cking mess. os.rename(source, dest) shutil.move(dest, target) - + log.debug('Setting up a New Virtual {python} Environment'.format( python = python )) - + # Path to Python Executable (Basically $PYTHONPTH) python = which(python) diff --git a/bench/commands/make.py b/bench/commands/make.py index 7a7d289e..eb0c21ba 100755 --- a/bench/commands/make.py +++ b/bench/commands/make.py @@ -2,7 +2,7 @@ import click @click.command() @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('--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")