From dd920222a5d64f4c01dbdb089f9a3cf1de4fcb8d Mon Sep 17 00:00:00 2001 From: Elijah Lazkani Date: Sat, 18 Mar 2017 23:46:50 -0400 Subject: [PATCH] Travis gets a special treatment --- .travis.yml | 2 -- .travis/grains.sh | 2 +- salty/base/python_env/init.sls | 10 +++++++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index b94ba50..d05ae63 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,5 +28,3 @@ install: script: - sudo salt-call --local --config=./ --state-output=changes --log-level=quiet --retcode-passthrough state.apply - - which pip - - which pip3 diff --git a/.travis/grains.sh b/.travis/grains.sh index dcde6f3..6524ae2 100644 --- a/.travis/grains.sh +++ b/.travis/grains.sh @@ -1,3 +1,3 @@ #!/bin/bash -salt-call --local --config=./ --state-output=changes grains.setvals "{ \"user\": \"$(whoami)\", \"group\": \"$(id -g -n $(whoami))\", \"homedir\": \"$HOME\", \"travis\": True }" +salt-call --local --config=./ --state-output=changes grains.setvals "{ \"user\": \"$(whoami)\", \"group\": \"$(id -g -n $(whoami))\", \"homedir\": \"$HOME\", \"travis\": True, \"pip\": \"$(which pip)\" }" diff --git a/salty/base/python_env/init.sls b/salty/base/python_env/init.sls index 7dce343..1075998 100644 --- a/salty/base/python_env/init.sls +++ b/salty/base/python_env/init.sls @@ -1,5 +1,13 @@ {% from "python_env/map.jinja" import python_env with context %} +{% if grains['travis'] == True and grains['kernel'] == 'Linux' %} + {% if "python2" in grains['pip'] %} + {% set python_env.pip_bin_env = "/opt/python/3.5.2/bin/pip3" %} + {% else %} + {% set python_env.pip_bin_env = grains['pip'] %} + {% endif %} +{% endif %} + pip-install: pkg.installed: - name: {{ python_env.pip }} @@ -24,7 +32,7 @@ zsh-virtualenvwrapper: file.append: - name: {{ grains.homedir }}/.zshrc - text: - - "" + - "\n" - "# Adding virtualenvwrapper python binary path" - "export VIRTUALENVWRAPPER_PYTHON={{ python_env.python_path }}" - ""