From eb167317c219e8087e514185c86a2a3559bed3b1 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Wed, 20 Mar 2019 05:55:10 +0000 Subject: [PATCH] Use union for list combinations to ensure uniqueness Rather than adding two lists together then passing them through the 'unique' filter to remove duplicates, we combine the two actions by using the union filter. Change-Id: I8b032f3b5d043e543c1d0fd0434d833385ceecc4 --- tasks/python_venv_install.yml | 4 ++-- tasks/python_venv_wheel_build.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tasks/python_venv_install.yml b/tasks/python_venv_install.yml index c0c9349..fa54f8c 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_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) }}" + name: "{{ (venv_wheel_build_enable | bool) | ternary(venv_install_distro_package_list, (venv_build_base_distro_package_list | union(venv_build_distro_package_list) | union(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) }}" @@ -109,7 +109,7 @@ - name: Install python packages into the venv pip: - name: "{{ (venv_default_pip_packages + venv_pip_packages) | unique | sort }}" + name: "{{ (venv_default_pip_packages | union(venv_pip_packages)) | sort }}" state: "{{ venv_pip_package_state }}" virtualenv: "{{ venv_install_destination_path }}" extra_args: >- diff --git a/tasks/python_venv_wheel_build.yml b/tasks/python_venv_wheel_build.yml index 71041c5..7ef3978 100644 --- a/tasks/python_venv_wheel_build.yml +++ b/tasks/python_venv_wheel_build.yml @@ -21,7 +21,7 @@ block: - name: Install distro packages for wheel build package: - name: "{{ (venv_build_base_distro_package_list + venv_build_distro_package_list) | unique }}" + name: "{{ venv_build_base_distro_package_list | union(venv_build_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) }}"