From b84199341f1e13b43b8754dadafda219c16259d8 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Mon, 18 Mar 2019 18:32:35 +0000 Subject: [PATCH] Add toggle for python wheel build process If a package (like stackviz) should be installed using a tarball, rather than from a git source, then it is better to be able to disable the wheel build process, constraints usage, etc and just install it from the tarball. Change-Id: Id1dc504586a3a1bbd7a161b7367606ced3789043 --- defaults/main.yml | 6 ++++++ tasks/python_venv_install.yml | 4 ++-- tasks/python_venv_wheel_build.yml | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 2079712..e74d997 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -95,6 +95,12 @@ venv_python_executable: "python2" # installed packages. venv_rebuild: no +# Enable/disable the build of python wheels +# If the package concerned is built from a tarball, rather +# than from a git source or pypi, then this may be best to +# set to false. +venv_wheel_build_enable: "{{ venv_build_host != inventory_hostname }}" + # Set the host where the wheels will be built. # If this host is not the same as the target host, then # python wheels will be built in order to speed up the diff --git a/tasks/python_venv_install.yml b/tasks/python_venv_install.yml index 6b26078..c0c9349 100644 --- a/tasks/python_venv_install.yml +++ b/tasks/python_venv_install.yml @@ -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_base_distro_package_list + venv_build_distro_package_list + venv_install_distro_package_list) | unique) }}" + name: "{{ (venv_wheel_build_enable | bool) | 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) }}" @@ -77,7 +77,7 @@ copy: dest: "{{ venv_install_destination_path }}/constraints.txt" content: | - {% if (venv_build_host != inventory_hostname) and + {% if (venv_wheel_build_enable | bool) and (_constraints_file_slurp is defined) and (_constraints_file_slurp.content is defined) %} {{ _constraints_file_slurp.content | b64decode }} diff --git a/tasks/python_venv_wheel_build.yml b/tasks/python_venv_wheel_build.yml index e4d5a6b..71041c5 100644 --- a/tasks/python_venv_wheel_build.yml +++ b/tasks/python_venv_wheel_build.yml @@ -17,7 +17,7 @@ delegate_to: "{{ venv_build_host }}" become: "{{ venv_build_host == 'localhost' }}" when: - - venv_build_host != inventory_hostname + - venv_wheel_build_enable | bool block: - name: Install distro packages for wheel build package: