Fix for PEP517 issue with Python 3.6.8

When creating a virtualenv with Python 3.6.8 using the
--system-site-packages option and pip>=19.0.0 a bug affects
the virtualenv breaking pep build isolation.
This patch downgrade pip to version 19.0.0 as a
workaround.

Also converts pip3 command to pip.

See [1] for more info.

[1] https://github.com/pypa/pip/issues/6264

Change-Id: I738d7c2e50914a773920e5381305e8c5131ccd5f
This commit is contained in:
Riccardo Pittau 2020-02-11 15:40:22 +01:00
parent 1d2ab2b841
commit 19b9f685b5
4 changed files with 21 additions and 8 deletions

View File

@ -309,7 +309,7 @@ ironic_inspector:
# DEPRECATED(TheJulia): Inheritance of ironic_db_password params
# should be removed in Queens.
pip_opts: "--upgrade-strategy only-if-needed"
pip_opts: "{{ lookup('env', 'PIP_OPTS') | default('') }}"
# Timeout for gathering facts.
fact_gather_timeout: "{{ lookup('config', 'DEFAULT_GATHER_TIMEOUT', on_missing='skip') | default(omit, true) }}"

View File

@ -19,6 +19,11 @@
venv_command: "python3 -m venv"
when: enable_venv
- name: workaround for PEP517 issue
set_fact:
extra_args: ""
when: ansible_python_version == "3.6.8"
- name: Set extra_args if upper_constraints_file is defined
set_fact:
constraints_extra_args: "{{ extra_args | default('') }} -c {{ upper_constraints_file }}"
@ -57,12 +62,10 @@
delay: 10
when: (source_install is not defined or source_install | bool == false ) and enable_venv | default(false) | bool == false
# NOTE (cinerama): We should be able to use the pip module here
- name: "Install requirements from {{ sourcedir }} using pip"
command: |
pip3 install -r {{ sourcedir }}/requirements.txt
{{ extra_args | default('') }}
{% if upper_constraints_file %}-c {{ upper_constraints_file }}{% endif %}
pip:
extra_args: "{{ extra_args | default('') }} {% if upper_constraints_file %}-c {{ upper_constraints_file }}{% endif %}"
requirements: "{{ sourcedir }}/requirements.txt"
register: pip_package_install_done
until: pip_package_install_done is succeeded
retries: 5

View File

@ -61,4 +61,4 @@ keystone:
password: ChangeThisPa55w0rd
host: localhost
pip_opts: "--upgrade-strategy only-if-needed"
pip_opts: "{{ lookup('env', 'PIP_OPTS') | default('') }}"

View File

@ -156,7 +156,17 @@ PYTHON=$(which python3)
# requests, one of our indirect dependencies (bug 1459947).
#
ls $PYTHON
sudo -H -E $PYTHON -m pip install -U pip --ignore-installed
# workaround for PEP517 issue
PYTHON_VER=$($PYTHON -V)
if [[ $PYTHON_VER == "Python 3.6.8" ]]; then
sudo -H -E $PYTHON -m pip install pip==19.0 --ignore-installed
export PIP_OPTS=""
else
sudo -H -E $PYTHON -m pip install -U pip --ignore-installed
export PIP_OPTS="--upgrade-strategy only-if-needed"
fi
if [ "$?" != "0" ]; then
wget -O /tmp/get-pip.py https://bootstrap.pypa.io/3.4/get-pip.py
sudo -H -E ${PYTHON} /tmp/get-pip.py