diff --git a/docs/releasenotes.rst b/docs/releasenotes.rst index 8b8f19d816030b20e95045cefd5762d14191931c..a89cb0483a48e910d9b9df3612a0413cef0703ee 100644 --- a/docs/releasenotes.rst +++ b/docs/releasenotes.rst @@ -2,6 +2,18 @@ Release notes ============= +x.y.z +----- + +**Bug fixes:** + +* ``common`` role + + * Fix deprecation warnings for Python requirements upgrade checks + when using pip-tools 7.3.0. This would result in unnecessary + notifications being sent out to server administrator. + + 7.1.0 ----- diff --git a/roles/common/files/pip_check_requirements_upgrades.sh b/roles/common/files/pip_check_requirements_upgrades.sh index 7a6f321b980d8f6348135a81428eea0ec9ba0b8b..0ed3d5030ce8e4fb97a0e6d8d1b692c16e3f8cce 100755 --- a/roles/common/files/pip_check_requirements_upgrades.sh +++ b/roles/common/files/pip_check_requirements_upgrades.sh @@ -237,17 +237,33 @@ for environment in "$config_dir"/*; do # package versioning information. current=$(sed -e 's/[[:blank:]]*#.*//' "$req_txt" | grep -v "^$" | sort -u) - # Calculate up-to-date requirements. Use backtracking resolver if available. + # Set-up pip-compile invocation based on available options, + # partially in order to get rid of the warnings. + pip_compile_invocation=( + "pip-compile" + "--quiet" + "--allow-unsafe" + "--no-header" + "--no-annotate" + "--no-emit-index-url" + ) + if pip-compile --help | grep -q -- --resolver; then - new=$(pip-compile --quiet --resolver backtracking --allow-unsafe --no-header --no-annotate --no-emit-index-url --output-file - --upgrade "$req_in") - result="$?" - else - new=$(pip-compile --quiet --allow-unsafe --no-header --no-annotate --no-emit-index-url --output-file - --upgrade "$req_in") - result="$?" + pip_compile_invocation+=("--resolver=backtracking") fi - if [[ $result != 0 ]]; then - error "Failed while running pip-compile command against (see error stack trace above): $req_in" + if pip-compile --help | grep -q -- --strip-extras; then + pip_compile_invocation+=("--strip-extras") + fi + + pip_compile_invocation+=( + "--output-file" "-" + "--upgrade" "$req_in" + ) + + # Calculate up-to-date requirements. + if ! new=$("${pip_compile_invocation[@]}"); then + error "Failed while running pip-compile command against (see error stack trace above): $req_in" continue fi