Add a check to ensure that a PyPi package hasn't already been injected into a pipx venv before injecting it again
The pipx module reports nothing is changed when the same version of a PyPi package is reinjected in to a venv
however when using the command
module there isn't a check that the package is already installed, so it appears that it has changed when it hasn't.
Checking is made more complicated by the fact that the proposed list looks like this:
{
"ans_pypi_pkgs": [
{
"name": "ansible",
"url": "https://pypi.org/pypi/ansible",
"version": "7.3.0"
},
{
"name": "ansible-lint",
"url": "https://pypi.org/pypi/ansible-lint",
"venv": "ansible",
"version": "6.14.2"
},
{
"name": "jc",
"url": "https://pypi.org/pypi/jc",
"venv": "ansible",
"version": "1.23.0"
},
{
"name": "jmespath",
"url": "https://pypi.org/pypi/jmespath",
"venv": "ansible",
"version": "1.0.1"
},
{
"name": "molecule",
"url": "https://pypi.org/pypi/molecule",
"venv": "ansible",
"version": "4.0.4"
},
{
"extras": [
"docker"
],
"name": "molecule-plugins",
"url": "https://pypi.org/pypi/molecule-plugins",
"venv": "ansible",
"version": "23.0.0"
},
{
"name": "yamllint",
"url": "https://pypi.org/pypi/yamllint",
"venv": "ansible",
"version": "1.29.0"
}
]
}
And the existing list looks like this:
{
"ans_pipx_injected": [
{
"name": "ansible-lint",
"version": "6.14.2"
},
{
"name": "jc",
"version": "1.23.0"
},
{
"name": "jmespath",
"version": "1.0.1"
},
{
"name": "molecule",
"version": "4.0.4"
},
{
"name": "molecule-plugins",
"version": "23.0.0"
},
{
"name": "yamllint",
"version": "1.29.0"
}
]
}
So the existing list needs the extras
adding and the proposed list needs to only be a subset of items with a matching venv
and the url
and venv
then need omitting before they can be properly compared.