packages-formula/packages/pips.sls

47 lines
1.3 KiB
Text
Raw Normal View History

2018-02-12 08:16:03 -03:00
# -*- coding: utf-8 -*-
# vim: ft=sls
{% from "packages/map.jinja" import packages with context %}
{% set req_states = packages.pips.required.states %}
{% set req_pkgs = packages.pips.required.pkgs %}
{% set wanted_pips = packages.pips.wanted %}
{% set unwanted_pips = packages.pips.unwanted %}
### REQ PKGS (without these, some of the WANTED PIPS will fail to install)
pip_req_pkgs:
pkg.installed:
- pkgs: {{ req_pkgs }}
### PYTHON PKGS to install using PIP
# (requires the python-pip deb/rpm installed, either by the system or listed in
# the required packages
{% for pn in wanted_pips %}
packages pips install {{ pn }}:
{%- if grains.os_family in ('Suse',) %} ##workaround https://github.com/saltstack-formulas/docker-formula/issues/198
cmd.run:
- name: /usr/bin/pip install {{ pn }}
{%- else %}
2018-02-12 08:16:03 -03:00
pip.installed:
2019-02-21 16:33:54 +00:00
- name: {{ pn }}
- reload_modules: true
{%- endif %}
2018-02-12 08:16:03 -03:00
- require:
- pkg: pip_req_pkgs
{% if req_states %}
{% for dep in req_states %}
- sls: {{ dep }}
{% endfor %}
{% endif %}
{% endfor %}
{% for upn in unwanted_pips %}
packages pips remove {{ upn }}:
{%- if grains.os_family in ('Suse',) %}
cmd.run:
- name: /usr/bin/pip uninstall {{ pn }}
{%- else %}
2019-02-21 16:33:54 +00:00
pip.removed:
- name: {{ upn }}
{%- endif %}
2018-02-12 08:16:03 -03:00
{% endfor %}