Simplify pip/setuptools/wheel prep for venvs

Similarly to I7204c09ed0e2dbc03aab5ce74684d88d985ce411
we can simply stop using get-pip.py any more and just
use the pip that is already in the virtualenv. This
cuts down on yet another reliance on get-pip.py and
makes offline installs simpler.

Depends-On: https://review.openstack.org/587835
Change-Id: Ia58554d222f27eac772df7d8dfb2394c1881fc82
This commit is contained in:
Jesse Pretorius 2018-08-07 22:16:18 +01:00 committed by Jesse Pretorius (odyssey4me)
parent d7acac1b99
commit caef3380fe
3 changed files with 12 additions and 39 deletions

View File

@ -97,20 +97,12 @@ repo_build_venv_pip_install_options: >-
--timeout 120
--find-links {{ repo_build_release_path }}
# Rather than allow virtualenv to decide which version
# of pip/setuptools/wheel we use, we create the virtualenv
# without them and use get-pip.py later to install them
# into the venv. This prevents messy upgrade/downgrade
# failures when trying to install the versions we want.
# NOTE(odyssey4me):
# Not using --always-copy for CentOS/SuSE due to
# https://github.com/pypa/virtualenv/issues/565
repo_build_venv_command_options: >-
{{ virtualenv_bin }}
{{ (ansible_pkg_mgr == 'apt') | ternary('--always-copy', '') }}
--no-pip
--no-setuptools
--no-wheel
# Path to the repo build venv binaries
repo_build_bin: "/openstack/venvs/repo-build-{{ repo_build_release_tag }}/bin"

View File

@ -128,22 +128,6 @@
src: "requirements_absolute_requirements.txt.j2"
dest: "{{ repo_build_release_path }}/requirements_absolute_requirements.txt"
- name: Get /opt/get-pip.py if it does not exist
get_url:
url: "{{ pip_upstream_url | default('https://bootstrap.pypa.io/3.3/get-pip.py') }}"
dest: "/opt/get-pip.py"
force: no
register: _get_pip
until: _get_pip is success
retries: 10
delay: 5
- name: Copy get-pip script into release folder
copy:
src: "/opt/get-pip.py"
dest: "{{ repo_build_release_path }}/"
remote_src: yes
- name: Clean up temporary build folders to save space
file:
path: "{{ item }}"

View File

@ -73,21 +73,18 @@ pushd "{{ repo_build_venv_dir }}" &>/dev/null
# Activate the python virtual environment for good measure
source "${ROLE_VENV_PATH}/bin/activate"
# Install pip, setuptools, wheel into it
# Rather than allow virtualenv to decide which version
# of pip/setuptools/wheel we use, we create the virtualenv
# without them and use get-pip.py later to install them
# into the venv. This prevents messy upgrade/downgrade
# failures when trying to install the versions we want.
# We also inform get-pip.py using the --find-links option
# that there are local wheels available so that it uses
# them instead of reaching out to the internet unnecessarily.
${ROLE_VENV_PATH}/bin/python {{ repo_build_release_path }}/get-pip.py \
pip setuptools wheel \
--find-links {{ repo_build_release_path }} \
${PIP_INSTALL_OPTIONS} \
--constraint {{ repo_build_release_path }}/requirements_constraints.txt \
&>${ROLE_VENV_LOG}
# Upgrade pip, setuptools and wheel to the version we want
${ROLE_VENV_PATH}/bin/pip install \
--disable-pip-version-check \
--quiet --quiet \
--build "/tmp/${ROLE_VENV_FILE}" \
${PIP_INSTALL_OPTIONS} \
--constraint {{ repo_build_release_path }}/requirements_constraints.txt \
--upgrade \
--index-url {{ repo_build_pip_default_index }} \
--trusted-host {{ repo_build_pip_default_index | netloc_no_port }} \
pip setuptools wheel \
--log "${ROLE_VENV_LOG}"
# Install the packages into the venv
${ROLE_VENV_PATH}/bin/pip install \