Skip to content
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

[7.17](backport #35501) retry pip upgrade #35659

Merged
merged 1 commit into from
Jun 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions dev-tools/mage/pytest.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package mage

import (
"errors"
"fmt"
"log"
"os"
Expand All @@ -30,7 +31,6 @@ import (

"github.com/magefile/mage/mg"
"github.com/magefile/mage/sh"
"github.com/pkg/errors"
)

// WINDOWS USERS:
Expand Down Expand Up @@ -233,16 +233,18 @@ func PythonVirtualenv() (string, error) {
"VIRTUAL_ENV": ve,
}

vePython := virtualenvPath(ve, pythonExe)
// Ensure we are using the latest pip version.
// use method described at https://pip.pypa.io/en/stable/installation/#upgrading-pip
if err = sh.RunWith(env, vePython, "-m", "pip", "install", "--upgrade", "pip"); err != nil {
fmt.Printf("warn: failed to upgrade pip (ignoring): %v", err)
}

pip := virtualenvPath(ve, "pip")
pipUpgrade := func(pkg string) error {
return sh.RunWith(env, pip, "install", "-U", pkg)
}

// Ensure we are using the latest pip version.
if err = pipUpgrade("pip"); err != nil {
fmt.Printf("warn: failed to upgrade pip (ignoring): %v", err)
}

// First ensure that wheel is installed so that bdists build cleanly.
if err = pipUpgrade("wheel"); err != nil {
return "", err
Expand Down
Loading