library/roles/python-env: Fix the recently broken pip deb package on ubuntu Trusty.

This commit is contained in:
Andrea Dell'Amico 2017-01-27 02:28:55 +01:00
parent a30c96eb88
commit d6bc63915f
3 changed files with 53 additions and 1 deletions

View File

@ -2,5 +2,14 @@
py_env_install: False
py_env_pkgs_state: installed
py_env_site: False
py_env_trusty_workaround: True
py_env_get_pip_url: https://bootstrap.pypa.io/get-pip.py
py_env_basic_pkgs:
- python-pip
py_env_pip_fix_ssl_warnings:
- pyOpenSSL
- cryptography
- idna
- certifi

View File

@ -0,0 +1,7 @@
#!/bin/bash
GET_PIP=/usr/local/lib/get-pip.py
chmod 755 $GET_PIP
$GET_PIP

View File

@ -1,6 +1,5 @@
---
- block:
- name: Install python pip
apt: name={{ item }} state={{ py_env_pkgs_state }} update_cache=yes cache_valid_time=600
with_items: '{{ py_env_basic_pkgs | default([]) }}'
@ -13,8 +12,45 @@
apt: name={{ item }} state={{ py_env_pkgs_state }} update_cache=yes cache_valid_time=600
with_items: '{{ py_pip_deps | default([]) }}'
- name: Fix the ssl warnings installing some ssl libraries
pip: name={{ item }}
with_items: '{{ py_env_pip_fix_ssl_warnings | default ([]) }}'
when:
- not py_env_trusty_workaround
- is_trusty
- name: Install a list of pip packages
pip: name={{ item }}
with_items: '{{ py_env_pip_pkgs | default ([]) }}'
when:
- not py_env_trusty_workaround
- is_trusty
when: py_env_install
tags: [ "python", "py_env" ]
- block:
- name: Install the get-pip.py pip downloader
get_url: url={{ py_env_get_pip_url }} dest=/usr/local/lib/get-pip.py
- name: Install a script that fixes the broken trusty pip package
copy: src=pip-fixer.sh dest=/usr/local/bin/python-pip-fixer mode=0755 owner=root group=root
register: python_pip_fixer
- name: Fix the trusty pip installation
shell: /usr/local/bin/python-pip-fixer
when: ( python_pip_fixer | changed )
- name: Fix the ssl warnings installing some ssl libraries
pip: name={{ item }}
with_items: '{{ py_env_pip_fix_ssl_warnings | default ([]) }}'
- name: Install a list of pip packages
pip: name={{ item }}
with_items: '{{ py_env_pip_pkgs | default ([]) }}'
when:
- py_env_trusty_workaround
- py_env_install
- is_trusty
tags: [ "python", "py_env" ]