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 }}" - ""