
When building from git sources or from master, pre-release wheels may be built. We need to ensure that they are used if they are present. For stable branches, we are still protected by the use of the constraints to ensure that we only get the packages we expect. Change-Id: I68e6d29cfb6a144d119eabdeb7e23bff73c51555
86 lines
2.8 KiB
YAML
86 lines
2.8 KiB
YAML
---
|
|
# Copyright 2018, Rackspace US, Inc.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
# TODO(odyssey4me):
|
|
# Set a fact for the selective inclusion of the build package list.
|
|
# Perhaps do this if the distro/architecture of the target host differs
|
|
# from the build host.
|
|
|
|
- name: Install distro packages for venv build
|
|
package:
|
|
name: "{{ venv_build_distro_package_list + venv_install_distro_package_list }}"
|
|
state: "{{ venv_distro_package_state }}"
|
|
update_cache: "{{ (ansible_pkg_mgr in ['apt', 'zypper']) | ternary('yes', omit) }}"
|
|
cache_valid_time: "{{ (ansible_pkg_mgr == 'apt') | ternary(venv_distro_cache_valid_time, omit) }}"
|
|
when:
|
|
- (venv_build_distro_package_list | length > 0) or
|
|
(venv_install_distro_package_list | length > 0)
|
|
register: _install_distro_packages
|
|
until: _install_distro_packages is success
|
|
retries: 5
|
|
delay: 2
|
|
|
|
- name: Ensure a fresh venv_install_destination_path if venv_rebuild is enabled
|
|
file:
|
|
path: "{{ venv_install_destination_path }}"
|
|
state: absent
|
|
when:
|
|
- venv_rebuild | bool
|
|
|
|
# NOTE(odyssey4me):
|
|
# Not using --always-copy for CentOS/SuSE due to
|
|
# https://github.com/pypa/virtualenv/issues/565
|
|
- name: Create the virtualenv (if it does not exist)
|
|
command: >-
|
|
virtualenv
|
|
{{ _venv_create_extra_options }}
|
|
--python={{ venv_python_executable }}
|
|
{{ (ansible_pkg_mgr == 'apt') | ternary('--always-copy', '') }}
|
|
{{ venv_install_destination_path }}
|
|
args:
|
|
creates: "{{ venv_install_destination_path }}/bin/activate"
|
|
|
|
- name: Upgrade pip/setuptools/wheel to the versions we want
|
|
pip:
|
|
name:
|
|
- pip
|
|
- setuptools
|
|
- wheel
|
|
state: "{{ venv_pip_package_state }}"
|
|
virtualenv: "{{ venv_install_destination_path }}"
|
|
extra_args: >-
|
|
--log /var/log/python_venv_build.log
|
|
{{ venv_pip_install_args }}
|
|
register: _update_virtualenv_packages
|
|
until: _update_virtualenv_packages is success
|
|
retries: 5
|
|
delay: 2
|
|
|
|
- name: Install python packages into the venv
|
|
pip:
|
|
name: "{{ venv_pip_packages }}"
|
|
state: "{{ venv_pip_package_state }}"
|
|
virtualenv: "{{ venv_install_destination_path }}"
|
|
extra_args: >-
|
|
--pre
|
|
--log /var/log/python_venv_build.log
|
|
{{ venv_pip_install_args }}
|
|
register: _install_venv_pip_packages
|
|
until: _install_venv_pip_packages is success
|
|
retries: 5
|
|
delay: 2
|
|
notify:
|
|
- venv changed
|