Add default distro packages for wheel builds

There are some packages which absolutely must be there
for all wheel builds, or for installing without wheels.
Without them, pip is totally unable to compile the
package due to missing headers or tooling.

This patch adds a default, minimal, set of compilers
and python headers.

Rather than use include_vars, with_first_found as we
do in most other roles, we use vars/main and a dict
based on ansible_os_family. The role is often included
by other roles, and we'd rather not risk the search
path being incorrect (there are constant bugs related
to this in ansible). Using this mechanism takes away
the need for an include_vars task and avoids any pathing
issues.

Change-Id: I4ef11e47e4d3fe5adc65e9888e660a5a121d205b
This commit is contained in:
Jesse Pretorius 2018-10-26 14:54:37 +01:00 committed by Jesse Pretorius (odyssey4me)
parent d515b0d7ff
commit c54aa8117e
4 changed files with 39 additions and 2 deletions

View File

@ -25,6 +25,10 @@
# Optional variables
#
# Distribution packages which must be installed
# on all hosts when building python wheels.
venv_build_base_distro_package_list: "{{ _venv_build_base_distro_package_list[ansible_os_family | lower] }}"
# Distribution packages which must be installed
# on the host for the purpose of building the
# python wheels.

View File

@ -20,7 +20,7 @@
- name: Install distro packages for venv build
package:
name: "{{ (venv_build_host != inventory_hostname) | ternary(venv_install_distro_package_list, venv_build_distro_package_list + venv_install_distro_package_list) }}"
name: "{{ (venv_build_host != inventory_hostname) | ternary(venv_install_distro_package_list, (venv_build_base_distro_package_list + venv_build_distro_package_list + venv_install_distro_package_list) | unique) }}"
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) }}"

View File

@ -21,7 +21,7 @@
block:
- name: Install distro packages for wheel build
package:
name: "{{ venv_build_distro_package_list }}"
name: "{{ (venv_build_base_distro_package_list + venv_build_distro_package_list) | unique }}"
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) }}"

33
vars/main.yml Normal file
View File

@ -0,0 +1,33 @@
---
# 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.
_venv_build_base_distro_package_list:
debian:
- cmake
- gcc
- "{{ (venv_python_executable == 'python2') | ternary('pkg-config', 'python3-pkgconfig') }}"
- "{{ (venv_python_executable == 'python2') | ternary('python-dev', 'python3-dev') }}"
redhat:
- autoconf
- cmake
- gcc
- gcc-c++
- "{{ (venv_python_executable == 'python2') | ternary('python2-devel', 'python3-devel') }}"
suse:
- autoconf
- cmake
- gcc
- gcc-c++
- "{{ (venv_python_executable == 'python2') | ternary('python-devel', 'python3-devel') }}"