pipx: fix state=latest w/ install_deps=true (#6303)

* pipx and pipx_info: Document that modules require pipx 0.16.2.1 or above

Since their introduction, these modules rely on 'pipx list --json' to
return machine-readable output about installed pipx applications. That
functionality was introduced in 0.16.2, along with a critical bug fix
(invalid json) in 0.16.2.1.

* pipx: fix state=latest with install_deps=true

"pipx upgrade" stopped supporting the "--include-deps" option
("install_deps" in the ansible module) in pipx 0.15
(https://pypa.github.io/pipx/changelog/#01500).

The lack of support causes the pipx module to fail if attempting to use
state=latest with install_deps, since the parameter is passed to both
pipx install (fine) and pipx upgrade (fails).

* Add changelog fragment
This commit is contained in:
Paul Aurich 2023-04-19 21:43:49 -07:00 committed by GitHub
parent ae5090d90e
commit 996fc8c18e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 3 deletions

View file

@ -57,7 +57,7 @@ options:
install_deps:
description:
- Include applications of dependent packages.
- Only used when I(state=install), I(state=latest), I(state=upgrade), or I(state=inject).
- Only used when I(state=install), I(state=latest), or I(state=inject).
type: bool
default: false
inject_packages:
@ -120,6 +120,7 @@ notes:
- >
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).
- This module requires C(pipx) version 0.16.2.1 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.
@ -263,7 +264,7 @@ class PipX(StateModuleHelper):
if self.vars.force:
self.changed = True
with self.runner('state include_injected index_url install_deps force editable pip_args name', check_mode_skip=True) as ctx:
with self.runner('state include_injected index_url force editable pip_args name', check_mode_skip=True) as ctx:
ctx.run()
self._capture_results(ctx)
@ -316,7 +317,7 @@ class PipX(StateModuleHelper):
ctx.run(state='install', name_source=[self.vars.name, self.vars.source])
self._capture_results(ctx)
with self.runner('state include_injected index_url install_deps force editable pip_args name', check_mode_skip=True) as ctx:
with self.runner('state include_injected index_url force editable pip_args name', check_mode_skip=True) as ctx:
ctx.run(state='upgrade')
self._capture_results(ctx)

View file

@ -53,6 +53,7 @@ notes:
- >
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).
- This module requires C(pipx) version 0.16.2.1 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/).
author: