pip: allow to drop a config file first

This commit is contained in:
Adrien "ze" Urban 2019-02-13 17:52:49 +01:00
parent d90024f38e
commit 9aa8d59660
3 changed files with 26 additions and 0 deletions

6
packages/files/pip.conf Normal file
View file

@ -0,0 +1,6 @@
{%- for section, settings in config.items()|sort -%}
[{{ section }}]
{%- for key, value in settings.items()|sort %}
{{ key }} = {{ value }}
{%- endfor %}
{% endfor %}

View file

@ -6,12 +6,24 @@
{% set req_pkgs = packages.pips.required.pkgs %}
{% set wanted_pips = packages.pips.wanted %}
{% set unwanted_pips = packages.pips.unwanted %}
{% set pip_config = packages.pips.config %}
### REQ PKGS (without these, some of the WANTED PIPS will fail to install)
pip_req_pkgs:
pkg.installed:
- pkgs: {{ req_pkgs }}
{% 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 %}
### PYTHON PKGS to install using PIP
# (requires the python-pip deb/rpm installed, either by the system or listed in
# the required packages
@ -26,6 +38,9 @@ pip_req_pkgs:
- sls: {{ dep }}
{% endfor %}
{% endif %}
{% if pip_config %}
- file: pip_config
{% endif %}
{% endfor %}
{% for upn in unwanted_pips %}

View file

@ -31,6 +31,11 @@ packages:
- campbel
- reverse_geocode
- indy-crypto
config:
global:
timeout: 120
default-timeout: 120
proxy: http://proxy.example.com:3128
gems:
wanted:
- progressbar