diff --git a/python-env/defaults/main.yml b/python-env/defaults/main.yml index ffcce4a6..c5d98db7 100644 --- a/python-env/defaults/main.yml +++ b/python-env/defaults/main.yml @@ -2,22 +2,7 @@ py_env_install: False py_env_pkgs_state: present 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_dev_packages: - - libpython-dev - - libssl-dev - - libffi-dev - -py_env_pip_fix_ssl_warnings: - - pyOpenSSL - - cryptography - - idna - - certifi - - ndg-httpsclient - - pyasn1 - diff --git a/python-env/files/pip-fixer.sh b/python-env/files/pip-fixer.sh deleted file mode 100644 index c4ecda36..00000000 --- a/python-env/files/pip-fixer.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -GET_PIP=/usr/local/lib/get-pip.py - -chmod 755 $GET_PIP - -$GET_PIP diff --git a/python-env/meta/main.yml b/python-env/meta/main.yml new file mode 100644 index 00000000..54330546 --- /dev/null +++ b/python-env/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - { role: '../../library/roles/ubuntu-python-setup', when: python_pip_env_workaround is not defined } diff --git a/python-env/tasks/main.yml b/python-env/tasks/main.yml index dcca4af1..b54e5461 100644 --- a/python-env/tasks/main.yml +++ b/python-env/tasks/main.yml @@ -4,6 +4,12 @@ apt: name={{ item }} state={{ py_env_pkgs_state }} update_cache=yes cache_valid_time=600 with_items: '{{ py_env_basic_pkgs | default([]) }}' + when: + - py_env_install + - python_pip_env_workaround is not defined + tags: [ "python", "py_env" ] + +- block: - name: Install python deb packages apt: name={{ item }} state={{ py_env_pkgs_state }} update_cache=yes cache_valid_time=600 with_items: '{{ py_env_dpkg | default([]) }}' @@ -12,45 +18,6 @@ apt: name={{ item }} state={{ py_env_pkgs_state }} update_cache=yes cache_valid_time=600 with_items: '{{ py_pip_deps | default([]) }}' - 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 is changed - - - name: Install the python dev headers and other dev requirements - apt: pkg={{ item }} state=present - with_items: '{{ py_env_pip_dev_packages }}' - - - name: Install a specific version of tornado to avoid breaking dependencies - pip: name=tornado version=4.1 state=present - - - name: Install the latest six python package - pip: name=six state=present - - - name: Install setuptools version 33.1.1 - pip: name=setuptools version=33.1.1 state=present - - when: - - py_env_trusty_workaround - - py_env_install - - is_trusty - tags: [ "python", "py_env" ] - -- block: - - 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 }} state=latest with_items: '{{ py_env_pip_pkgs | default ([]) }}' @@ -61,5 +28,4 @@ when: - py_env_install - - is_trusty tags: [ "python", "py_env", "py_env_pkgs" ]