Merge pull request #665 from joerick/ensurepip-2

Try using ensurepip instead of get-pip
This commit is contained in:
Joe Rickerby
2021-05-18 13:01:50 +01:00
committed by GitHub
5 changed files with 48 additions and 22340 deletions
-4
View File
@@ -22,7 +22,3 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Get-pip and Pip (bundled in cibuildwheel/resources) are licensed under the MIT
license. See https://github.com/pypa/get-pip/blob/master/LICENSE.txt
+23 -3
View File
@@ -19,7 +19,6 @@ from .util import (
NonPlatformWheelError,
download,
get_build_verbosity_extra_flags,
get_pip_script,
install_certifi_script,
prepare_command,
read_python_configs,
@@ -228,8 +227,29 @@ def setup_python(
)
sys.exit(1)
# install pip & wheel
call(["python", get_pip_script, *dependency_constraint_flags], env=env, cwd="/tmp")
# Install pip
requires_reinstall = not (installation_bin_path / "pip").exists()
if requires_reinstall:
# maybe pip isn't installed at all. ensurepip resolves that.
call(["python", "-m", "ensurepip"], env=env, cwd="/tmp")
# upgrade pip to the version matching our constraints
# if necessary, reinstall it to ensure that it's available on PATH as 'pip'
call(
[
"python",
"-m",
"pip",
"install",
"--force-reinstall" if requires_reinstall else "--upgrade",
"pip",
*dependency_constraint_flags,
],
env=env,
cwd="/tmp",
)
assert (installation_bin_path / "pip").exists()
call(["which", "pip"], env=env)
call(["pip", "--version"], env=env)
File diff suppressed because it is too large Load Diff
-1
View File
@@ -24,7 +24,6 @@ from .typing import PathOrStr, PlatformName
resources_dir = Path(__file__).parent / "resources"
get_pip_script = resources_dir / "get-pip.py"
install_certifi_script = resources_dir / "install_certifi.py"
+25 -10
View File
@@ -17,7 +17,6 @@ from .util import (
NonPlatformWheelError,
download,
get_build_verbosity_extra_flags,
get_pip_script,
prepare_command,
read_python_configs,
)
@@ -174,9 +173,31 @@ def setup_python(
)
sys.exit(1)
# make sure pip is installed
if not (installation_path / "Scripts" / "pip.exe").exists():
call(["python", get_pip_script, *dependency_constraint_flags], env=env, cwd="C:\\cibw")
log.step("Installing build tools...")
# Install pip
requires_reinstall = not (installation_path / "Scripts" / "pip.exe").exists()
if requires_reinstall:
# maybe pip isn't installed at all. ensurepip resolves that.
call(["python", "-m", "ensurepip"], env=env, cwd="C:\\cibw")
# upgrade pip to the version matching our constraints
# if necessary, reinstall it to ensure that it's available on PATH as 'pip.exe'
call(
[
"python",
"-m",
"pip",
"install",
"--force-reinstall" if requires_reinstall else "--upgrade",
"pip",
*dependency_constraint_flags,
],
env=env,
cwd="C:\\cibw",
)
assert (installation_path / "Scripts" / "pip.exe").exists()
where_pip = (
subprocess.run(
@@ -192,12 +213,6 @@ def setup_python(
)
sys.exit(1)
log.step("Installing build tools...")
call(
["python", "-m", "pip", "install", "--upgrade", "pip", *dependency_constraint_flags],
env=env,
)
call(["pip", "--version"], env=env)
call(
["pip", "install", "--upgrade", "setuptools", "wheel", *dependency_constraint_flags],