Merge pull request #41 from ze42/pip_config

pip: allow to drop a config file first
This commit is contained in:
Niels Abspoel 2019-02-28 20:00:27 +01:00 committed by GitHub
commit 1808d09910
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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 req_pkgs = packages.pips.required.pkgs %}
{% set wanted_pips = packages.pips.wanted %} {% set wanted_pips = packages.pips.wanted %}
{% set unwanted_pips = packages.pips.unwanted %} {% 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) ### REQ PKGS (without these, some of the WANTED PIPS will fail to install)
pip_req_pkgs: pip_req_pkgs:
pkg.installed: pkg.installed:
- pkgs: {{ req_pkgs }} - 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 ### PYTHON PKGS to install using PIP
# (requires the python-pip deb/rpm installed, either by the system or listed in # (requires the python-pip deb/rpm installed, either by the system or listed in
# the required packages # the required packages
@ -32,6 +44,9 @@ packages pips install {{ pn }}:
- sls: {{ dep }} - sls: {{ dep }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if pip_config %}
- file: pip_config
{% endif %}
{% endfor %} {% endfor %}
{% for upn in unwanted_pips %} {% for upn in unwanted_pips %}

View file

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