From c94cd6c4b6efdec2352b5887a1b774d128997a6e Mon Sep 17 00:00:00 2001 From: Mohammed Naser Date: Fri, 29 Mar 2019 12:24:11 -0400 Subject: [PATCH] Add option to upgrade PyPI/etc without using site config There are sometimes buggy releases of PyPI shipped by the distributions which don't react well to pip.conf config options such extra index URLs which make it impossible to upgrade it. This adds a a variable which allows working around this issue by ignoring the site config to do the upgrade. Change-Id: I5266d827f19e14c6313b11408913e2f754befaca --- defaults/main.yml | 5 +++++ tasks/python_venv_install.yml | 2 ++ tasks/python_venv_wheel_build.yml | 2 ++ 3 files changed, 9 insertions(+) diff --git a/defaults/main.yml b/defaults/main.yml index e74d997..6ba0114 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -56,6 +56,11 @@ venv_default_pip_packages: [] # into the venv. venv_pip_packages: [] +# Don't use the site-wide PIP configuration file when +# upgrading PIP (some operating systems have issued +# with upgrades w/ extra-index-urls) +venv_pip_upgrade_noconf: false + # A list of constraints to be applied when building # or installing python packages. venv_build_constraints: [] diff --git a/tasks/python_venv_install.yml b/tasks/python_venv_install.yml index 514a328..7f8f573 100644 --- a/tasks/python_venv_install.yml +++ b/tasks/python_venv_install.yml @@ -100,6 +100,8 @@ --log /var/log/python_venv_build.log {{ venv_default_pip_install_args }} {{ venv_pip_install_args }} + environment: + PIP_CONFIG_FILE: "{{ (venv_pip_upgrade_noconf | bool) | ternary('/dev/null', '') }}" register: _update_virtualenv_packages until: _update_virtualenv_packages is success retries: 5 diff --git a/tasks/python_venv_wheel_build.yml b/tasks/python_venv_wheel_build.yml index 7ef3978..d1f5c25 100644 --- a/tasks/python_venv_wheel_build.yml +++ b/tasks/python_venv_wheel_build.yml @@ -99,6 +99,8 @@ --find-links {{ venv_build_host_wheel_path }}/ --log /var/log/python_venv_build.log {{ venv_pip_build_args }} + environment: + PIP_CONFIG_FILE: "{{ (venv_pip_upgrade_noconf | bool) | ternary('/dev/null', '') }}" register: _update_virtualenv_packages until: _update_virtualenv_packages is success retries: 5