1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

pipx: add testcase w/ env vars PIPX_xxxx (#5845)

* pipx: add testcase w/ env vars PIPX_xxxx

* add note to the docs about env vars

* add note to the docs about env vars

* Apply suggestions from code review

* Update plugins/modules/pipx.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/pipx_info.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* break long lines into smaller ones

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Alexei Znamensky 2023-01-19 09:28:16 +13:00 committed by GitHub
parent a35b2eda4c
commit 1430ed000c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 0 deletions

View file

@ -95,6 +95,9 @@ options:
notes: notes:
- This module does not install the C(pipx) python package, however that can be easily done with the module M(ansible.builtin.pip). - This module does not install the C(pipx) python package, however that can be easily done with the module M(ansible.builtin.pip).
- This module does not require C(pipx) to be in the shell C(PATH), but it must be loadable by Python as a module. - This module does not require C(pipx) to be in the shell C(PATH), but it must be loadable by Python as a module.
- >
This module will honor C(pipx) environment variables such as but not limited to C(PIPX_HOME) and C(PIPX_BIN_DIR)
passed using the R(environment Ansible keyword, playbooks_environment).
- Please note that C(pipx) requires Python 3.6 or above. - Please note that C(pipx) requires Python 3.6 or above.
- > - >
This first implementation does not verify whether a specified version constraint has been installed or not. This first implementation does not verify whether a specified version constraint has been installed or not.

View file

@ -50,6 +50,9 @@ options:
notes: notes:
- This module does not install the C(pipx) python package, however that can be easily done with the module M(ansible.builtin.pip). - This module does not install the C(pipx) python package, however that can be easily done with the module M(ansible.builtin.pip).
- This module does not require C(pipx) to be in the shell C(PATH), but it must be loadable by Python as a module. - This module does not require C(pipx) to be in the shell C(PATH), but it must be loadable by Python as a module.
- >
This module will honor C(pipx) environment variables such as but not limited to C(PIPX_HOME) and C(PIPX_BIN_DIR)
passed using the R(environment Ansible keyword, playbooks_environment).
- Please note that C(pipx) requires Python 3.6 or above. - Please note that C(pipx) requires Python 3.6 or above.
- See also the C(pipx) documentation at U(https://pypa.github.io/pipx/). - See also the C(pipx) documentation at U(https://pypa.github.io/pipx/).
author: author:

View file

@ -230,3 +230,30 @@
that: that:
- install_jupyter is changed - install_jupyter is changed
- '"ipython" in install_jupyter.stdout' - '"ipython" in install_jupyter.stdout'
##############################################################################
- 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