7
7
BUCKET = {{ cookiecutter.s3_bucket }}
8
8
PROJECT_NAME = {{ cookiecutter.repo_name }}
9
9
PYTHON_INTERPRETER = {{ cookiecutter.python_interpreter }}
10
+ IS_ANACONDA =$(shell python -c "import sys;t=str('anaconda' in sys.version.lower() or 'continuum' in sys.version.lower());sys.stdout.write(t)")
10
11
11
12
# ################################################################################
12
13
# COMMANDS #
@@ -38,12 +39,21 @@ sync_data_from_s3:
38
39
39
40
# # Set up python interpreter environment
40
41
create_environment :
41
- @pip install -q virtualenvwrapper
42
+ ifeq (True,$(IS_ANACONDA ) )
43
+ @echo ">>> Detected Anaconda, creating conda environment."
44
+ ifeq (3,$(findstr 3,$(PYTHON_INTERPRETER ) ) )
45
+ conda create --name $(PROJECT_NAME) python=3.5
46
+ else
47
+ conda create --name $(PROJECT_NAME) python=2.7
48
+ endif
49
+ @echo ">>> New conda env created. Activate with:\nsource activate $(PROJECT_NAME)"
50
+ else
51
+ @pip install -q virtualenv virtualenvwrapper
42
52
@echo ">>> Installing virtualenvwrapper if not already intalled.\nMake sure the following lines are in shell startup file\n\
43
- export WORKON_HOME=$HOME /.virtualenvs\n export PROJECT_HOME=$HOME /Devel\n source /usr/local/bin/virtualenvwrapper.sh\n "
44
-
45
- source /usr/local/bin/virtualenvwrapper.sh; mkvirtualenv $(PROJECT_NAME) --python=$(PYTHON_INTERPRETER)
53
+ export WORKON_HOME=$$HOME/.virtualenvs\nexport PROJECT_HOME=$$HOME/Devel\nsource /usr/local/bin/virtualenvwrapper.sh\n"
54
+ @bash -c "source `which virtualenvwrapper.sh`;mkvirtualenv $(PROJECT_NAME) --python=$(PYTHON_INTERPRETER)"
46
55
@echo ">>> New virtualenv created. Activate with:\nworkon $(PROJECT_NAME)"
56
+ endif
47
57
48
58
# # Test python environment is setup correctly
49
59
test_environment :
@@ -114,4 +124,4 @@ show-help:
114
124
} \
115
125
printf " \n" ; \
116
126
}' \
117
- | more $(shell test $(shell uname) == Darwin && echo '--no-init --raw-control-chars')
127
+ | more $(shell test $(shell uname) == Darwin && echo '--no-init --raw-control-chars')
0 commit comments