pinch-dotfiles/salty/base/python_env/init.sls
2017-03-19 00:17:26 -04:00

48 lines
1.4 KiB
Text

{% from "python_env/map.jinja" import python_env with context %}
{% if grains['travis'] == True and grains['kernel'] == 'Linux' %}
{% if "python2" in grains['pip'] %}
{% set pip_travis_env = '/opt/python/3.5.2/bin/pip3' %}
{% else %}
{% set pip_travis_env = grains['pip'] %}
{% endif %}
{% endif %}
pip-install:
pkg.installed:
- name: {{ python_env.pip }}
virtualenv-install:
pip.installed:
- name: {{ python_env.virtualenv }}
- user: {{ grains.user }}
{% if grains['travis'] == True and grains['kernel'] == 'Linux' %}
- bin_env: {{ pip_travis_env }}
{% else %}
- bin_env: {{ python_env.pip_bin_env }}
{% endif %}
- require:
- pkg: pip-install
virtualenvwrapper-install:
pip.installed:
- name: {{ python_env.virtualenvwrapper }}
- user: {{ grains.user }}
{% if grains['travis'] == True and grains['kernel'] == 'Linux' %}
- bin_env: {{ pip_travis_env }}
{% else %}
- bin_env: {{ python_env.pip_bin_env }}
{% endif %}
- require:
- pip: virtualenv-install
zsh-virtualenvwrapper:
file.append:
- name: {{ grains.homedir }}/.zshrc
- text:
- "\n"
- "# Adding virtualenvwrapper python binary path"
- "export VIRTUALENVWRAPPER_PYTHON={{ python_env.python_path }}"
- ""
- "# Sourcing virtualenv"
- "source {{ grains.homedir }}/.local/bin/virtualenvwrapper.sh"