2021-10-06 07:01:54 +02:00
|
|
|
---
|
2022-08-05 14:03:38 +02:00
|
|
|
# Copyright (c) Ansible Project
|
|
|
|
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2021-10-06 07:01:54 +02:00
|
|
|
- name: install pipx
|
|
|
|
pip:
|
|
|
|
name: pipx
|
|
|
|
extra_args: --user
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
- name: ensure application tox is uninstalled
|
|
|
|
community.general.pipx:
|
|
|
|
state: absent
|
|
|
|
name: tox
|
|
|
|
register: uninstall_tox
|
|
|
|
|
|
|
|
- name: install application tox
|
|
|
|
community.general.pipx:
|
|
|
|
name: tox
|
|
|
|
register: install_tox
|
|
|
|
|
2022-08-18 06:44:18 +02:00
|
|
|
- name: set fact latest_tox_version
|
|
|
|
set_fact:
|
|
|
|
latest_tox_version: "{{ install_tox.application.tox.version }}"
|
|
|
|
|
2021-10-06 07:01:54 +02:00
|
|
|
- name: install application tox again
|
|
|
|
community.general.pipx:
|
|
|
|
name: tox
|
|
|
|
register: install_tox_again
|
|
|
|
|
|
|
|
- name: install application tox again force
|
|
|
|
community.general.pipx:
|
|
|
|
name: tox
|
2023-02-15 22:55:23 +01:00
|
|
|
force: true
|
2021-10-06 07:01:54 +02:00
|
|
|
register: install_tox_again_force
|
|
|
|
|
|
|
|
- name: uninstall application tox
|
|
|
|
community.general.pipx:
|
|
|
|
state: absent
|
|
|
|
name: tox
|
|
|
|
register: uninstall_tox
|
|
|
|
|
|
|
|
- name: check assertions tox
|
|
|
|
assert:
|
|
|
|
that:
|
2022-08-18 06:44:18 +02:00
|
|
|
- install_tox is changed
|
|
|
|
- "'tox' in install_tox.application"
|
|
|
|
- install_tox_again is not changed
|
|
|
|
- install_tox_again_force is changed
|
|
|
|
- uninstall_tox is changed
|
|
|
|
- "'tox' not in uninstall_tox.application"
|
2021-10-06 07:01:54 +02:00
|
|
|
|
|
|
|
##############################################################################
|
2023-04-10 09:10:32 +02:00
|
|
|
- name: install application tox with system-site-packages
|
|
|
|
community.general.pipx:
|
|
|
|
name: tox
|
|
|
|
system_site_packages: true
|
|
|
|
register: install_tox
|
|
|
|
|
|
|
|
- name: get raw pipx_info
|
|
|
|
community.general.pipx_info:
|
|
|
|
include_raw: true
|
|
|
|
register: pipx_info_raw
|
|
|
|
|
|
|
|
- name: uninstall application tox
|
|
|
|
community.general.pipx:
|
|
|
|
state: absent
|
|
|
|
name: tox
|
|
|
|
register: uninstall_tox
|
|
|
|
|
|
|
|
- name: check assertions tox
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- install_tox is changed
|
|
|
|
- "'tox' in install_tox.application"
|
|
|
|
- pipx_info_raw is not changed
|
|
|
|
- "'--system-site-packages' in pipx_info_raw.raw_output.venvs.tox.metadata.venv_args"
|
|
|
|
- uninstall_tox is changed
|
|
|
|
- "'tox' not in uninstall_tox.application"
|
|
|
|
|
|
|
|
##############################################################################
|
2021-10-06 07:01:54 +02:00
|
|
|
- name: install application tox 3.24.0
|
|
|
|
community.general.pipx:
|
|
|
|
name: tox
|
|
|
|
source: tox==3.24.0
|
|
|
|
register: install_tox_324
|
|
|
|
|
|
|
|
- name: reinstall tox 3.24.0
|
|
|
|
community.general.pipx:
|
|
|
|
name: tox
|
|
|
|
state: reinstall
|
|
|
|
register: reinstall_tox_324
|
|
|
|
|
2022-08-09 10:15:51 +02:00
|
|
|
- name: reinstall without name
|
|
|
|
community.general.pipx:
|
|
|
|
state: reinstall
|
|
|
|
register: reinstall_noname
|
2023-02-15 22:55:23 +01:00
|
|
|
ignore_errors: true
|
2022-08-09 10:15:51 +02:00
|
|
|
|
2022-08-18 06:44:18 +02:00
|
|
|
- name: upgrade tox from 3.24.0
|
2021-10-06 07:01:54 +02:00
|
|
|
community.general.pipx:
|
|
|
|
name: tox
|
|
|
|
state: upgrade
|
|
|
|
register: upgrade_tox_324
|
|
|
|
|
2022-08-09 10:15:51 +02:00
|
|
|
- name: upgrade without name
|
|
|
|
community.general.pipx:
|
|
|
|
state: upgrade
|
|
|
|
register: upgrade_noname
|
2023-02-15 22:55:23 +01:00
|
|
|
ignore_errors: true
|
2022-08-09 10:15:51 +02:00
|
|
|
|
2021-10-06 07:01:54 +02:00
|
|
|
- name: downgrade tox 3.24.0
|
|
|
|
community.general.pipx:
|
|
|
|
name: tox
|
|
|
|
source: tox==3.24.0
|
2023-02-15 22:55:23 +01:00
|
|
|
force: true
|
2021-10-06 07:01:54 +02:00
|
|
|
register: downgrade_tox_324
|
|
|
|
|
|
|
|
- name: cleanup tox 3.24.0
|
|
|
|
community.general.pipx:
|
|
|
|
state: absent
|
|
|
|
name: tox
|
|
|
|
register: uninstall_tox_324
|
|
|
|
|
|
|
|
- name: check assertions tox 3.24.0
|
|
|
|
assert:
|
|
|
|
that:
|
2022-08-18 06:44:18 +02:00
|
|
|
- install_tox_324 is changed
|
|
|
|
- "'tox' in install_tox_324.application"
|
|
|
|
- install_tox_324.application.tox.version == '3.24.0'
|
|
|
|
- reinstall_tox_324 is changed
|
|
|
|
- reinstall_tox_324.application.tox.version == '3.24.0'
|
|
|
|
- upgrade_tox_324 is changed
|
|
|
|
- upgrade_tox_324.application.tox.version != '3.24.0'
|
|
|
|
- downgrade_tox_324 is changed
|
|
|
|
- downgrade_tox_324.application.tox.version == '3.24.0'
|
|
|
|
- uninstall_tox_324 is changed
|
|
|
|
- "'tox' not in uninstall_tox_324.application"
|
|
|
|
- upgrade_noname is failed
|
|
|
|
- reinstall_noname is failed
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
- name: install application latest tox
|
|
|
|
community.general.pipx:
|
|
|
|
name: tox
|
|
|
|
state: latest
|
|
|
|
register: install_tox_latest
|
|
|
|
|
|
|
|
- name: cleanup tox latest
|
|
|
|
community.general.pipx:
|
|
|
|
state: absent
|
|
|
|
name: tox
|
|
|
|
register: uninstall_tox_latest
|
|
|
|
|
|
|
|
- name: install application tox 3.24.0 for latest
|
|
|
|
community.general.pipx:
|
|
|
|
name: tox
|
|
|
|
source: tox==3.24.0
|
|
|
|
register: install_tox_324_for_latest
|
|
|
|
|
|
|
|
- name: install application latest tox
|
|
|
|
community.general.pipx:
|
|
|
|
name: tox
|
|
|
|
state: latest
|
|
|
|
register: install_tox_latest_with_preinstall
|
|
|
|
|
|
|
|
- name: install application latest tox again
|
|
|
|
community.general.pipx:
|
|
|
|
name: tox
|
|
|
|
state: latest
|
|
|
|
register: install_tox_latest_with_preinstall_again
|
|
|
|
|
|
|
|
- name: install application latest tox
|
|
|
|
community.general.pipx:
|
|
|
|
name: tox
|
|
|
|
state: latest
|
|
|
|
force: true
|
|
|
|
register: install_tox_latest_with_preinstall_again_force
|
|
|
|
|
|
|
|
- name: cleanup tox latest again
|
|
|
|
community.general.pipx:
|
|
|
|
state: absent
|
|
|
|
name: tox
|
|
|
|
register: uninstall_tox_latest_again
|
|
|
|
|
2023-04-20 06:43:49 +02:00
|
|
|
- name: install application tox with deps
|
|
|
|
community.general.pipx:
|
|
|
|
state: latest
|
|
|
|
name: tox
|
|
|
|
install_deps: true
|
|
|
|
register: install_tox_with_deps
|
|
|
|
|
|
|
|
- name: cleanup tox latest yet again
|
|
|
|
community.general.pipx:
|
|
|
|
state: absent
|
|
|
|
name: tox
|
|
|
|
register: uninstall_tox_again
|
|
|
|
|
2022-08-18 06:44:18 +02:00
|
|
|
- name: check assertions tox latest
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- install_tox_latest is changed
|
|
|
|
- uninstall_tox_latest is changed
|
|
|
|
- install_tox_324_for_latest is changed
|
|
|
|
- install_tox_324_for_latest.application.tox.version == '3.24.0'
|
|
|
|
- install_tox_latest_with_preinstall is changed
|
|
|
|
- install_tox_latest_with_preinstall.application.tox.version == latest_tox_version
|
|
|
|
- install_tox_latest_with_preinstall_again is not changed
|
|
|
|
- install_tox_latest_with_preinstall_again.application.tox.version == latest_tox_version
|
|
|
|
- install_tox_latest_with_preinstall_again_force is changed
|
|
|
|
- install_tox_latest_with_preinstall_again_force.application.tox.version == latest_tox_version
|
|
|
|
- uninstall_tox_latest_again is changed
|
2023-04-20 06:43:49 +02:00
|
|
|
- install_tox_with_deps is changed
|
|
|
|
- install_tox_with_deps.application.tox.version == latest_tox_version
|
|
|
|
- uninstall_tox_again is changed
|
|
|
|
- "'tox' not in uninstall_tox_again.application"
|
2021-10-30 08:11:57 +02:00
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
- name: ensure application ansible-lint is uninstalled
|
|
|
|
community.general.pipx:
|
|
|
|
name: ansible-lint
|
|
|
|
state: absent
|
|
|
|
|
|
|
|
- name: install application ansible-lint
|
|
|
|
community.general.pipx:
|
|
|
|
name: ansible-lint
|
|
|
|
register: install_ansible_lint
|
|
|
|
|
|
|
|
- name: inject packages
|
|
|
|
community.general.pipx:
|
|
|
|
state: inject
|
|
|
|
name: ansible-lint
|
|
|
|
inject_packages:
|
|
|
|
- licenses
|
|
|
|
register: inject_pkgs_ansible_lint
|
|
|
|
|
2023-03-26 09:17:55 +02:00
|
|
|
- name: inject packages with apps
|
|
|
|
community.general.pipx:
|
|
|
|
state: inject
|
|
|
|
name: ansible-lint
|
|
|
|
inject_packages:
|
|
|
|
- black
|
|
|
|
install_apps: true
|
|
|
|
register: inject_pkgs_apps_ansible_lint
|
|
|
|
|
2021-10-30 08:11:57 +02:00
|
|
|
- name: cleanup ansible-lint
|
|
|
|
community.general.pipx:
|
|
|
|
state: absent
|
|
|
|
name: ansible-lint
|
|
|
|
register: uninstall_ansible_lint
|
|
|
|
|
|
|
|
- name: check assertions inject_packages
|
|
|
|
assert:
|
|
|
|
that:
|
2022-08-18 06:44:18 +02:00
|
|
|
- install_ansible_lint is changed
|
|
|
|
- inject_pkgs_ansible_lint is changed
|
|
|
|
- '"ansible-lint" in inject_pkgs_ansible_lint.application'
|
|
|
|
- '"licenses" in inject_pkgs_ansible_lint.application["ansible-lint"]["injected"]'
|
2023-03-26 09:17:55 +02:00
|
|
|
- inject_pkgs_apps_ansible_lint is changed
|
|
|
|
- '"ansible-lint" in inject_pkgs_apps_ansible_lint.application'
|
|
|
|
- '"black" in inject_pkgs_apps_ansible_lint.application["ansible-lint"]["injected"]'
|
2022-08-18 06:44:18 +02:00
|
|
|
- uninstall_ansible_lint is changed
|
2021-11-30 07:10:20 +01:00
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
- name: install jupyter - not working smoothly in freebsd
|
|
|
|
when: ansible_system != 'FreeBSD'
|
2022-08-18 06:44:18 +02:00
|
|
|
block:
|
|
|
|
- name: ensure application jupyter is uninstalled
|
|
|
|
community.general.pipx:
|
|
|
|
name: jupyter
|
|
|
|
state: absent
|
|
|
|
|
|
|
|
- name: install application jupyter
|
|
|
|
community.general.pipx:
|
|
|
|
name: jupyter
|
|
|
|
install_deps: true
|
|
|
|
register: install_jupyter
|
|
|
|
|
|
|
|
- name: cleanup jupyter
|
|
|
|
community.general.pipx:
|
|
|
|
state: absent
|
|
|
|
name: jupyter
|
|
|
|
|
|
|
|
- name: check assertions
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- install_jupyter is changed
|
|
|
|
- '"ipython" in install_jupyter.stdout'
|
2023-01-18 21:28:16 +01:00
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
- name: ensure /opt/pipx
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: /opt/pipx
|
|
|
|
state: directory
|
|
|
|
mode: 0755
|
|
|
|
|
|
|
|
- name: install tox site-wide
|
|
|
|
community.general.pipx:
|
|
|
|
name: tox
|
|
|
|
state: latest
|
|
|
|
register: install_tox_sitewide
|
|
|
|
environment:
|
|
|
|
PIPX_HOME: /opt/pipx
|
|
|
|
PIPX_BIN_DIR: /usr/local/bin
|
|
|
|
|
|
|
|
- name: stat /usr/local/bin/tox
|
|
|
|
ansible.builtin.stat:
|
|
|
|
path: /usr/local/bin/tox
|
|
|
|
register: usrlocaltox
|
|
|
|
|
|
|
|
- name: check assertions
|
|
|
|
ansible.builtin.assert:
|
|
|
|
that:
|
|
|
|
- install_tox_sitewide is changed
|
|
|
|
- usrlocaltox.stat.exists
|
2023-11-11 12:36:48 +01:00
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# Test for issue 7497
|
|
|
|
- name: ensure application pyinstaller is uninstalled
|
|
|
|
community.general.pipx:
|
|
|
|
name: pyinstaller
|
|
|
|
state: absent
|
|
|
|
|
|
|
|
- name: Install Python Package pyinstaller
|
|
|
|
community.general.pipx:
|
|
|
|
name: pyinstaller
|
|
|
|
state: present
|
|
|
|
system_site_packages: true
|
|
|
|
pip_args: "--no-cache-dir"
|
|
|
|
register: install_pyinstaller
|
|
|
|
|
|
|
|
- name: cleanup pyinstaller
|
|
|
|
community.general.pipx:
|
|
|
|
name: pyinstaller
|
|
|
|
state: absent
|
|
|
|
|
|
|
|
- name: check assertions
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- install_pyinstaller is changed
|