Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- pipx - fixed handling of ``install_deps=true`` with ``state=latest`` and ``state=upgrade`` (https://github.com/ansible-collections/community.general/pull/6303).
7 changes: 4 additions & 3 deletions plugins/modules/pipx.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
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).
darkrain42 marked this conversation as resolved.
Show resolved Hide resolved
type: bool
default: false
inject_packages:
Expand Down Expand Up @@ -113,6 +113,7 @@
- >
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.
Expand Down Expand Up @@ -255,7 +256,7 @@ def state_upgrade(self):
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)

Expand Down Expand Up @@ -308,7 +309,7 @@ def state_latest(self):
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)

Expand Down
1 change: 1 addition & 0 deletions plugins/modules/pipx_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
- >
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:
Expand Down
17 changes: 17 additions & 0 deletions tests/integration/targets/pipx/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,19 @@
name: tox
register: uninstall_tox_latest_again

- 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

- name: check assertions tox latest
assert:
that:
Expand All @@ -170,6 +183,10 @@
- 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
- 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"

##############################################################################
- name: ensure application ansible-lint is uninstalled
Expand Down