Remove pip --prefix workaround (#74922)

Remove --prefix workaround

See discussion in https://github.com/home-assistant/core/issues/74405.

This workaround is no longer needed on pip >= 21.0 and actively causes problems for pip >= 21.3.
pull/74967/head
henryptung 2022-07-11 02:33:28 -07:00 committed by GitHub
parent f6fd7d115e
commit 7d27dad190
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 5 deletions

View File

@ -89,9 +89,6 @@ def install_package(
# This only works if not running in venv
args += ["--user"]
env["PYTHONUSERBASE"] = os.path.abspath(target)
# Workaround for incompatible prefix setting
# See http://stackoverflow.com/a/4495175
args += ["--prefix="]
_LOGGER.debug("Running pip command: args=%s", args)
with Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE, env=env) as process:
_, stderr = process.communicate()

View File

@ -137,7 +137,6 @@ def test_install_target(mock_sys, mock_popen, mock_env_copy, mock_venv):
"--quiet",
TEST_NEW_REQ,
"--user",
"--prefix=",
]
assert package.install_package(TEST_NEW_REQ, False, target=target)
@ -156,7 +155,7 @@ def test_install_target_venv(mock_sys, mock_popen, mock_env_copy, mock_venv):
def test_install_error(caplog, mock_sys, mock_popen, mock_venv):
"""Test an install with a target."""
"""Test an install that errors out."""
caplog.set_level(logging.WARNING)
mock_popen.return_value.returncode = 1
assert not package.install_package(TEST_NEW_REQ)