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 %}
|
2019-02-13 17:52:49 +01:00
|
|
|
{% set pip_config = packages.pips.config %}
|
2018-02-12 08:16:03 -03:00
|
|
|
|
2019-03-10 22:47:54 -03:00
|
|
|
{% if req_states %}
|
|
|
|
include:
|
|
|
|
{% for dep in req_states %}
|
|
|
|
- {{ dep }}
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
|
|
|
|
2018-02-12 08:16:03 -03:00
|
|
|
### REQ PKGS (without these, some of the WANTED PIPS will fail to install)
|
|
|
|
pip_req_pkgs:
|
|
|
|
pkg.installed:
|
2019-03-05 20:12:25 -03:00
|
|
|
- pkgs: {{ req_pkgs | json }}
|
2018-02-12 08:16:03 -03:00
|
|
|
|
2019-02-13 17:52:49 +01:00
|
|
|
{% if pip_config %}
|
|
|
|
pip_config:
|
|
|
|
file.managed:
|
|
|
|
- name: /etc/pip.conf
|
|
|
|
- source: salt://{{ slspath }}/files/pip.conf
|
|
|
|
- template: jinja
|
|
|
|
- makedirs: True
|
|
|
|
- context:
|
|
|
|
config: {{ pip_config|json }}
|
|
|
|
{% endif %}
|
|
|
|
|
2018-02-12 08:16:03 -03:00
|
|
|
### 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 %}
|
2019-02-21 15:20:42 +00:00
|
|
|
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 }}
|
2018-02-21 07:10:25 -03:00
|
|
|
- reload_modules: true
|
2019-02-21 15:20:42 +00:00
|
|
|
{%- 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 %}
|
2019-02-13 17:52:49 +01:00
|
|
|
{% if pip_config %}
|
|
|
|
- file: pip_config
|
|
|
|
{% endif %}
|
2019-06-24 12:21:47 +01:00
|
|
|
- retry: {{ packages.retry_options|json }}
|
2018-02-12 08:16:03 -03:00
|
|
|
{% endfor %}
|
|
|
|
|
|
|
|
{% for upn in unwanted_pips %}
|
2019-02-21 15:20:42 +00:00
|
|
|
packages pips remove {{ upn }}:
|
|
|
|
{%- if grains.os_family in ('Suse',) %}
|
|
|
|
cmd.run:
|
2019-03-06 09:41:23 -03:00
|
|
|
- name: /usr/bin/pip uninstall {{ upn }}
|
2019-02-21 15:20:42 +00:00
|
|
|
{%- else %}
|
2019-02-21 16:33:54 +00:00
|
|
|
pip.removed:
|
2019-02-21 15:20:42 +00:00
|
|
|
- name: {{ upn }}
|
|
|
|
{%- endif %}
|
2018-02-12 08:16:03 -03:00
|
|
|
{% endfor %}
|