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