From 7d27dad1902336e959fab97db2e6e5bad33520d3 Mon Sep 17 00:00:00 2001 From: henryptung Date: Mon, 11 Jul 2022 02:33:28 -0700 Subject: [PATCH] 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. --- homeassistant/util/package.py | 3 --- tests/util/test_package.py | 3 +-- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/homeassistant/util/package.py b/homeassistant/util/package.py index aad93e37542..18ab43967ec 100644 --- a/homeassistant/util/package.py +++ b/homeassistant/util/package.py @@ -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() diff --git a/tests/util/test_package.py b/tests/util/test_package.py index d6b7402a5b6..7ab087f1463 100644 --- a/tests/util/test_package.py +++ b/tests/util/test_package.py @@ -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)