Check for conda before using it to create an environment.

This commit is contained in:
Keld Lundgaard 2017-02-26 12:18:46 -05:00 committed by Peter Bull
parent adf935ba53
commit a6a8c66e2d
1 changed files with 8 additions and 3 deletions

View File

@ -7,7 +7,12 @@
BUCKET = {{ cookiecutter.s3_bucket }}
PROJECT_NAME = {{ cookiecutter.repo_name }}
PYTHON_INTERPRETER = {{ cookiecutter.python_interpreter }}
IS_ANACONDA=$(shell python -c "import sys;t=str('anaconda' in sys.version.lower() or 'continuum' in sys.version.lower());sys.stdout.write(t)")
ifeq (,$(shell which conda))
HAS_CONDA=False
else
HAS_CONDA=True
endif
#################################################################################
# COMMANDS #
@ -39,8 +44,8 @@ sync_data_from_s3:
## Set up python interpreter environment
create_environment:
ifeq (True,$(IS_ANACONDA))
@echo ">>> Detected Anaconda, creating conda environment."
ifeq (True,$(HAS_CONDA))
@echo ">>> Detected conda, creating conda environment."
ifeq (3,$(findstring 3,$(PYTHON_INTERPRETER)))
conda create --name $(PROJECT_NAME) python=3.5
else