-
Notifications
You must be signed in to change notification settings - Fork 23.8k
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
pip module: During --check, if latest is asked, check using pip list --outdated #72298
Conversation
The test
The test
The test
|
Python 2.6. |
The test
The test
|
The test
The test
|
Related to this, |
Closing due to inactivity. If this is still something you wish to pursue then please open a new PR. We expect tests to be added for any changes made that fixes issues or updates the behaviour. |
Mabe fixes #62826
SUMMARY
In the pip module, I'm using
pip list --outdated
to list outdated Python packages, in order for--check
to be able to tell if a package withstate=latest
is to be upgraded or not.Current situation is to always return
changed=True
when a packaged isstate=latest
, even if it's at the latest version.The diff may be bigger than absolutely needed:
_is_present
takes an unused parameter, so I dropped it, as it's really near my diffs anyway.if module.check_mode
a bit long for what it does (30 lines) itself in a 195 lines of codemain
function, I had hard times understanding it. So I took care of decreasing the complexity instead of increasing it during my implementation by moving a part dedicated to clean and enhance currently installed packaged in the function dedicated to it, and by implementing my code in a dedicated function too. Now the main is 188 lines (a tad shorter), and theif module.check_mode
is 23 lines (with a feature added!).pkg_list = [p for p in out.split('\n')
... line, using theout
variable instead of theout_pip
variable, theout
variable could contain unexpected content from previous runs (setup venv, a few lines before)._get_packages
was used elsewhere, and only with a very old pip, as_get_packages
was not addingpip
andsetuptools
to the list, if the installation was to install pip or setuptools, it may get unnoticed bychanged = out_freeze_before != out_freeze_after
.The whole thing clearly lacks tests, I only tested it myself and it worked as expected (--check telling a module should be updated, running the playbook upgrades the module, --check again tells it's OK), but I'm out of time for today and have no idea how to test it for now (any hint appreciated).
ISSUE TYPE
COMPONENT NAME
pip