1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-04-18 09:51:41 +00:00

pipx, pipx_info: refactor (#11640)

* pipx, pipx_info: refactor

* add changelog frag
This commit is contained in:
Alexei Znamensky 2026-03-31 18:08:50 +13:00 committed by GitHub
parent 8568594453
commit bc98b2aa3b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 21 additions and 24 deletions

View file

@ -130,8 +130,6 @@ version:
version_added: 10.1.0
"""
from ansible.module_utils.facts.compat import ansible_facts
from ansible_collections.community.general.plugins.module_utils.module_helper import ModuleHelper
from ansible_collections.community.general.plugins.module_utils.pipx import (
make_process_dict,
@ -156,12 +154,7 @@ class PipXInfo(ModuleHelper):
)
def __init_module__(self):
if self.vars.executable:
self.command = [self.vars.executable]
else:
facts = ansible_facts(self.module, gather_subset=["python"])
self.command = [facts["python"]["executable"], "-m", "pipx"]
self.runner = pipx_runner(self.module, self.command)
self.runner = pipx_runner(self.module, self.vars.executable)
with self.runner("version") as ctx:
rc, out, err = ctx.run()
self.vars.version = out.strip()