90 lines
3.3 KiB
YAML
90 lines
3.3 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.
|
|
|
|
- name: Build the wheels on the build host
|
|
delegate_to: "{{ venv_build_host }}"
|
|
become: "{{ venv_build_host == 'localhost' }}"
|
|
when:
|
|
- venv_build_host != inventory_hostname
|
|
block:
|
|
- name: Install distro packages for wheel 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_build_distro_packages
|
|
until: _install_build_distro_packages is success
|
|
retries: 5
|
|
delay: 2
|
|
|
|
- name: Ensure a fresh venv_build_host_venv_path if venv_rebuild is enabled
|
|
file:
|
|
path: "{{ venv_build_host_venv_path }}"
|
|
state: absent
|
|
when:
|
|
- venv_rebuild | bool
|
|
|
|
- name: Create wheel directory on the build host
|
|
file:
|
|
path: "{{ venv_build_host_wheel_path }}"
|
|
state: directory
|
|
|
|
# NOTE(odyssey4me):
|
|
# Not using --always-copy for CentOS/SuSE due to
|
|
# https://github.com/pypa/virtualenv/issues/565
|
|
- name: Create the wheel build virtualenv (if it does not exist)
|
|
command: >-
|
|
virtualenv
|
|
{{ _venv_create_extra_options }}
|
|
--python={{ venv_python_executable }}
|
|
{{ (ansible_pkg_mgr == 'apt') | ternary('--always-copy', '') }}
|
|
{{ venv_build_host_venv_path }}
|
|
args:
|
|
creates: "{{ venv_build_host_venv_path }}/bin/activate"
|
|
|
|
- name: Upgrade the wheel build virtualenv pip/setuptools/wheel to the versions we want
|
|
pip:
|
|
name:
|
|
- pip
|
|
- setuptools
|
|
- wheel
|
|
state: "{{ venv_pip_package_state }}"
|
|
virtualenv: "{{ venv_build_host_venv_path }}"
|
|
extra_args: >-
|
|
--find-links {{ venv_build_host_wheel_path }}/
|
|
--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: Build wheels for the packages to be installed into the venv
|
|
command: >-
|
|
{{ venv_build_host_venv_path }}/bin/pip wheel
|
|
--wheel-dir {{ venv_build_host_wheel_path }}/
|
|
--find-links {{ venv_build_host_wheel_path }}/
|
|
--log /var/log/python_wheel_build.log
|
|
{{ venv_pip_install_args }}
|
|
{{ venv_pip_packages | join(' ') }}
|
|
register: _build_python_wheels
|
|
until: _build_python_wheels is success
|
|
retries: 5
|
|
delay: 2
|