From 6fa64a6b285ae8e5daaccbf346fb922bd023a494 Mon Sep 17 00:00:00 2001 From: Chris Hunt Date: Wed, 6 Nov 2019 21:10:19 -0500 Subject: [PATCH] Calculate header directories in one place This was already happening in locations.distutils_scheme, we're just reusing the existing work instead of doing it again. --- src/pip/_internal/req/req_install.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/pip/_internal/req/req_install.py b/src/pip/_internal/req/req_install.py index 5a86532ccc0..674545c9f53 100644 --- a/src/pip/_internal/req/req_install.py +++ b/src/pip/_internal/req/req_install.py @@ -8,7 +8,6 @@ import os import shutil import sys -import sysconfig import zipfile from distutils.util import change_root @@ -896,12 +895,7 @@ def install( install_options = list(install_options) + \ self.options.get('install_options', []) - header_dir = None # type: Optional[str] - if running_under_virtualenv(): - py_ver_str = 'python' + sysconfig.get_python_version() - header_dir = os.path.join( - sys.prefix, 'include', 'site', py_ver_str, self.name - ) + header_dir = scheme.headers with TempDirectory(kind="record") as temp_dir: record_filename = os.path.join(temp_dir.path, 'install-record.txt')