From a6a8c66e2d9065a24c8f19b9d116456d494dfb75 Mon Sep 17 00:00:00 2001 From: Keld Lundgaard Date: Sun, 26 Feb 2017 12:18:46 -0500 Subject: [PATCH] Check for conda before using it to create an environment. --- {{ cookiecutter.repo_name }}/Makefile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/{{ cookiecutter.repo_name }}/Makefile b/{{ cookiecutter.repo_name }}/Makefile index 4a58a71..7c37768 100644 --- a/{{ cookiecutter.repo_name }}/Makefile +++ b/{{ cookiecutter.repo_name }}/Makefile @@ -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