Detect conda and support conda envs; tweaks for vanilla virtualenv (#51)
* OSX Junk in gitignore * Support conda envs by default * Make it run on vanilla Ubuntu
This commit is contained in:
parent
947a36a86a
commit
1caa67be43
|
@ -1 +1,4 @@
|
|||
docs/site/
|
||||
|
||||
# OSX Junk
|
||||
.DS_Store
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
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)")
|
||||
|
||||
#################################################################################
|
||||
# COMMANDS #
|
||||
|
@ -38,12 +39,21 @@ sync_data_from_s3:
|
|||
|
||||
## Set up python interpreter environment
|
||||
create_environment:
|
||||
@pip install -q virtualenvwrapper
|
||||
ifeq (True,$(IS_ANACONDA))
|
||||
@echo ">>> Detected Anaconda, creating conda environment."
|
||||
ifeq (3,$(findstr 3,$(PYTHON_INTERPRETER)))
|
||||
conda create --name $(PROJECT_NAME) python=3.5
|
||||
else
|
||||
conda create --name $(PROJECT_NAME) python=2.7
|
||||
endif
|
||||
@echo ">>> New conda env created. Activate with:\nsource activate $(PROJECT_NAME)"
|
||||
else
|
||||
@pip install -q virtualenv virtualenvwrapper
|
||||
@echo ">>> Installing virtualenvwrapper if not already intalled.\nMake sure the following lines are in shell startup file\n\
|
||||
export WORKON_HOME=$HOME/.virtualenvs\nexport PROJECT_HOME=$HOME/Devel\nsource /usr/local/bin/virtualenvwrapper.sh\n"
|
||||
|
||||
source /usr/local/bin/virtualenvwrapper.sh; mkvirtualenv $(PROJECT_NAME) --python=$(PYTHON_INTERPRETER)
|
||||
export WORKON_HOME=$$HOME/.virtualenvs\nexport PROJECT_HOME=$$HOME/Devel\nsource /usr/local/bin/virtualenvwrapper.sh\n"
|
||||
@bash -c "source `which virtualenvwrapper.sh`;mkvirtualenv $(PROJECT_NAME) --python=$(PYTHON_INTERPRETER)"
|
||||
@echo ">>> New virtualenv created. Activate with:\nworkon $(PROJECT_NAME)"
|
||||
endif
|
||||
|
||||
## Test python environment is setup correctly
|
||||
test_environment:
|
||||
|
|
Loading…
Reference in New Issue