mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
pipx: added options editable and pip_args (#4303)
* pipx: added options editable and pip_args * added changelog fragment * added version markers on new options
This commit is contained in:
parent
a9db4742fc
commit
f988eb5726
2 changed files with 23 additions and 5 deletions
2
changelogs/fragments/4303-pipx-editable.yml
Normal file
2
changelogs/fragments/4303-pipx-editable.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
minor_changes:
|
||||||
|
- pipx - added options ``editable`` and ``pip_args`` (https://github.com/ansible-collections/community.general/issues/4300).
|
|
@ -78,6 +78,17 @@ options:
|
||||||
If not specified, the module will use C(python -m pipx) to run the tool,
|
If not specified, the module will use C(python -m pipx) to run the tool,
|
||||||
using the same Python interpreter as ansible itself.
|
using the same Python interpreter as ansible itself.
|
||||||
type: path
|
type: path
|
||||||
|
editable:
|
||||||
|
description:
|
||||||
|
- Install the project in editable mode.
|
||||||
|
type: bool
|
||||||
|
default: false
|
||||||
|
version_added: 4.6.0
|
||||||
|
pip_args:
|
||||||
|
description:
|
||||||
|
- Arbitrary arguments to pass directly to C(pip).
|
||||||
|
type: str
|
||||||
|
version_added: 4.6.0
|
||||||
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.
|
||||||
|
@ -153,7 +164,9 @@ class PipX(CmdStateModuleHelper):
|
||||||
include_injected=dict(type='bool', default=False),
|
include_injected=dict(type='bool', default=False),
|
||||||
index_url=dict(type='str'),
|
index_url=dict(type='str'),
|
||||||
python=dict(type='str'),
|
python=dict(type='str'),
|
||||||
executable=dict(type='path')
|
executable=dict(type='path'),
|
||||||
|
editable=dict(type='bool', default=False),
|
||||||
|
pip_args=dict(type='str'),
|
||||||
),
|
),
|
||||||
required_if=[
|
required_if=[
|
||||||
('state', 'present', ['name']),
|
('state', 'present', ['name']),
|
||||||
|
@ -174,6 +187,8 @@ class PipX(CmdStateModuleHelper):
|
||||||
index_url=dict(fmt=('--index-url', '{0}'),),
|
index_url=dict(fmt=('--index-url', '{0}'),),
|
||||||
python=dict(fmt=('--python', '{0}'),),
|
python=dict(fmt=('--python', '{0}'),),
|
||||||
_list=dict(fmt=('list', '--include-injected', '--json'), style=ArgFormat.BOOLEAN),
|
_list=dict(fmt=('list', '--include-injected', '--json'), style=ArgFormat.BOOLEAN),
|
||||||
|
editable=dict(fmt="--editable", style=ArgFormat.BOOLEAN),
|
||||||
|
pip_args=dict(fmt=('--pip-args', '{0}'),),
|
||||||
)
|
)
|
||||||
check_rc = True
|
check_rc = True
|
||||||
run_command_fixed_options = dict(
|
run_command_fixed_options = dict(
|
||||||
|
@ -224,7 +239,8 @@ class PipX(CmdStateModuleHelper):
|
||||||
if not self.vars.application or self.vars.force:
|
if not self.vars.application or self.vars.force:
|
||||||
self.changed = True
|
self.changed = True
|
||||||
if not self.module.check_mode:
|
if not self.module.check_mode:
|
||||||
self.run_command(params=['state', 'index_url', 'install_deps', 'force', 'python',
|
self.run_command(params=[
|
||||||
|
'state', 'index_url', 'install_deps', 'force', 'python', 'editable', 'pip_args',
|
||||||
{'name_source': [self.vars.name, self.vars.source]}])
|
{'name_source': [self.vars.name, self.vars.source]}])
|
||||||
|
|
||||||
state_present = state_install
|
state_present = state_install
|
||||||
|
@ -236,7 +252,7 @@ class PipX(CmdStateModuleHelper):
|
||||||
if self.vars.force:
|
if self.vars.force:
|
||||||
self.changed = True
|
self.changed = True
|
||||||
if not self.module.check_mode:
|
if not self.module.check_mode:
|
||||||
self.run_command(params=['state', 'index_url', 'install_deps', 'force', 'name'])
|
self.run_command(params=['state', 'index_url', 'install_deps', 'force', 'editable', 'pip_args', 'name'])
|
||||||
|
|
||||||
def state_uninstall(self):
|
def state_uninstall(self):
|
||||||
if self.vars.application and not self.module.check_mode:
|
if self.vars.application and not self.module.check_mode:
|
||||||
|
@ -259,7 +275,7 @@ class PipX(CmdStateModuleHelper):
|
||||||
if self.vars.force:
|
if self.vars.force:
|
||||||
self.changed = True
|
self.changed = True
|
||||||
if not self.module.check_mode:
|
if not self.module.check_mode:
|
||||||
self.run_command(params=['state', 'index_url', 'force', 'name', 'inject_packages'])
|
self.run_command(params=['state', 'index_url', 'force', 'editable', 'pip_args', 'name', 'inject_packages'])
|
||||||
|
|
||||||
def state_uninstall_all(self):
|
def state_uninstall_all(self):
|
||||||
if not self.module.check_mode:
|
if not self.module.check_mode:
|
||||||
|
|
Loading…
Reference in a new issue