We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Use sysconfig.get_preferred_scheme etc.
Todo to self. This has been implemented for 3.10 and we should support is in 21.2.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/pip/_internal/locations/_sysconfig.py`
Content:
```
1 import distutils.util  # FIXME: For change_root.
2 import logging
3 import os
4 import sys
5 import sysconfig
6 import typing
7 
8 from pip._internal.exceptions import InvalidSchemeCombination, UserInstallationInvalid
9 from pip._internal.models.scheme import SCHEME_KEYS, Scheme
10 from pip._internal.utils.virtualenv import running_under_virtualenv
11 
12 from .base import get_major_minor_version, is_osx_framework
13 
14 logger = logging.getLogger(__name__)
15 
16 
17 # Notes on _infer_* functions.
18 # Unfortunately ``_get_default_scheme()`` is private, so there's no way to
19 # ask things like "what is the '_prefix' scheme on this platform". These
20 # functions try to answer that with some heuristics while accounting for ad-hoc
21 # platforms not covered by CPython's default sysconfig implementation. If the
22 # ad-hoc implementation does not fully implement sysconfig, we'll fall back to
23 # a POSIX scheme.
24 
25 _AVAILABLE_SCHEMES = set(sysconfig.get_scheme_names())
26 
27 
28 def _infer_prefix() -> str:
29     """Try to find a prefix scheme for the current platform.
30 
31     This tries:
32 
33     * A special ``osx_framework_library`` for Python distributed by Apple's
34       Command Line Tools, when not running in a virtual environment.
35     * Implementation + OS, used by PyPy on Windows (``pypy_nt``).
36     * Implementation without OS, used by PyPy on POSIX (``pypy``).
37     * OS + "prefix", used by CPython on POSIX (``posix_prefix``).
38     * Just the OS name, used by CPython on Windows (``nt``).
39 
40     If none of the above works, fall back to ``posix_prefix``.
41     """
42     os_framework_global = is_osx_framework() and not running_under_virtualenv()
43     if os_framework_global and "osx_framework_library" in _AVAILABLE_SCHEMES:
44         return "osx_framework_library"
45     implementation_suffixed = f"{sys.implementation.name}_{os.name}"
46     if implementation_suffixed in _AVAILABLE_SCHEMES:
47         return implementation_suffixed
48     if sys.implementation.name in _AVAILABLE_SCHEMES:
49         return sys.implementation.name
50     suffixed = f"{os.name}_prefix"
51     if suffixed in _AVAILABLE_SCHEMES:
52         return suffixed
53     if os.name in _AVAILABLE_SCHEMES:  # On Windows, prefx is just called "nt".
54         return os.name
55     return "posix_prefix"
56 
57 
58 def _infer_user() -> str:
59     """Try to find a user scheme for the current platform."""
60     if is_osx_framework() and not running_under_virtualenv():
61         suffixed = "osx_framework_user"
62     else:
63         suffixed = f"{os.name}_user"
64     if suffixed in _AVAILABLE_SCHEMES:
65         return suffixed
66     if "posix_user" not in _AVAILABLE_SCHEMES:  # User scheme unavailable.
67         raise UserInstallationInvalid()
68     return "posix_user"
69 
70 
71 def _infer_home() -> str:
72     """Try to find a home for the current platform."""
73     suffixed = f"{os.name}_home"
74     if suffixed in _AVAILABLE_SCHEMES:
75         return suffixed
76     return "posix_home"
77 
78 
79 # Update these keys if the user sets a custom home.
80 _HOME_KEYS = [
81     "installed_base",
82     "base",
83     "installed_platbase",
84     "platbase",
85     "prefix",
86     "exec_prefix",
87 ]
88 if sysconfig.get_config_var("userbase") is not None:
89     _HOME_KEYS.append("userbase")
90 
91 
92 def get_scheme(
93     dist_name: str,
94     user: bool = False,
95     home: typing.Optional[str] = None,
96     root: typing.Optional[str] = None,
97     isolated: bool = False,
98     prefix: typing.Optional[str] = None,
99 ) -> Scheme:
100     """
101     Get the "scheme" corresponding to the input parameters.
102 
103     :param dist_name: the name of the package to retrieve the scheme for, used
104         in the headers scheme path
105     :param user: indicates to use the "user" scheme
106     :param home: indicates to use the "home" scheme
107     :param root: root under which other directories are re-based
108     :param isolated: ignored, but kept for distutils compatibility (where
109         this controls whether the user-site pydistutils.cfg is honored)
110     :param prefix: indicates to use the "prefix" scheme and provides the
111         base directory for the same
112     """
113     if user and prefix:
114         raise InvalidSchemeCombination("--user", "--prefix")
115     if home and prefix:
116         raise InvalidSchemeCombination("--home", "--prefix")
117 
118     if home is not None:
119         scheme_name = _infer_home()
120     elif user:
121         scheme_name = _infer_user()
122     else:
123         scheme_name = _infer_prefix()
124 
125     if home is not None:
126         variables = {k: home for k in _HOME_KEYS}
127     elif prefix is not None:
128         variables = {k: prefix for k in _HOME_KEYS}
129     else:
130         variables = {}
131 
132     paths = sysconfig.get_paths(scheme=scheme_name, vars=variables)
133 
134     # Logic here is very arbitrary, we're doing it for compatibility, don't ask.
135     # 1. Pip historically uses a special header path in virtual environments.
136     # 2. If the distribution name is not known, distutils uses 'UNKNOWN'. We
137     #    only do the same when not running in a virtual environment because
138     #    pip's historical header path logic (see point 1) did not do this.
139     if running_under_virtualenv():
140         if user:
141             base = variables.get("userbase", sys.prefix)
142         else:
143             base = variables.get("base", sys.prefix)
144         python_xy = f"python{get_major_minor_version()}"
145         paths["include"] = os.path.join(base, "include", "site", python_xy)
146     elif not dist_name:
147         dist_name = "UNKNOWN"
148 
149     scheme = Scheme(
150         platlib=paths["platlib"],
151         purelib=paths["purelib"],
152         headers=os.path.join(paths["include"], dist_name),
153         scripts=paths["scripts"],
154         data=paths["data"],
155     )
156     if root is not None:
157         for key in SCHEME_KEYS:
158             value = distutils.util.change_root(root, getattr(scheme, key))
159             setattr(scheme, key, value)
160     return scheme
161 
162 
163 def get_bin_prefix() -> str:
164     # Forcing to use /usr/local/bin for standard macOS framework installs.
165     if sys.platform[:6] == "darwin" and sys.prefix[:16] == "/System/Library/":
166         return "/usr/local/bin"
167     return sysconfig.get_paths()["scripts"]
168 
169 
170 def get_purelib() -> str:
171     return sysconfig.get_paths()["purelib"]
172 
173 
174 def get_platlib() -> str:
175     return sysconfig.get_paths()["platlib"]
176 
177 
178 def get_prefixed_libs(prefix: str) -> typing.Tuple[str, str]:
179     paths = sysconfig.get_paths(vars={"base": prefix, "platbase": prefix})
180     return (paths["purelib"], paths["platlib"])
181
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/src/pip/_internal/locations/_sysconfig.py b/src/pip/_internal/locations/_sysconfig.py
--- a/src/pip/_internal/locations/_sysconfig.py
+++ b/src/pip/_internal/locations/_sysconfig.py
@@ -24,6 +24,8 @@
 
 _AVAILABLE_SCHEMES = set(sysconfig.get_scheme_names())
 
+_HAS_PREFERRED_SCHEME_API = sys.version_info >= (3, 10)
+
 
 def _infer_prefix() -> str:
     """Try to find a prefix scheme for the current platform.
@@ -39,6 +41,8 @@
 
     If none of the above works, fall back to ``posix_prefix``.
     """
+    if _HAS_PREFERRED_SCHEME_API:
+        return sysconfig.get_preferred_scheme("prefix")  # type: ignore
     os_framework_global = is_osx_framework() and not running_under_virtualenv()
     if os_framework_global and "osx_framework_library" in _AVAILABLE_SCHEMES:
         return "osx_framework_library"
@@ -57,6 +61,8 @@
 
 def _infer_user() -> str:
     """Try to find a user scheme for the current platform."""
+    if _HAS_PREFERRED_SCHEME_API:
+        return sysconfig.get_preferred_scheme("user")  # type: ignore
     if is_osx_framework() and not running_under_virtualenv():
         suffixed = "osx_framework_user"
     else:
@@ -70,6 +76,8 @@
 
 def _infer_home() -> str:
     """Try to find a home for the current platform."""
+    if _HAS_PREFERRED_SCHEME_API:
+        return sysconfig.get_preferred_scheme("home")  # type: ignore
     suffixed = f"{os.name}_home"
     if suffixed in _AVAILABLE_SCHEMES:
         return suffixed

{"golden_diff": "diff --git a/src/pip/_internal/locations/_sysconfig.py b/src/pip/_internal/locations/_sysconfig.py\n--- a/src/pip/_internal/locations/_sysconfig.py\n+++ b/src/pip/_internal/locations/_sysconfig.py\n@@ -24,6 +24,8 @@\n \n _AVAILABLE_SCHEMES = set(sysconfig.get_scheme_names())\n \n+_HAS_PREFERRED_SCHEME_API = sys.version_info >= (3, 10)\n+\n \n def _infer_prefix() -> str:\n     \"\"\"Try to find a prefix scheme for the current platform.\n@@ -39,6 +41,8 @@\n \n     If none of the above works, fall back to ``posix_prefix``.\n     \"\"\"\n+    if _HAS_PREFERRED_SCHEME_API:\n+        return sysconfig.get_preferred_scheme(\"prefix\")  # type: ignore\n     os_framework_global = is_osx_framework() and not running_under_virtualenv()\n     if os_framework_global and \"osx_framework_library\" in _AVAILABLE_SCHEMES:\n         return \"osx_framework_library\"\n@@ -57,6 +61,8 @@\n \n def _infer_user() -> str:\n     \"\"\"Try to find a user scheme for the current platform.\"\"\"\n+    if _HAS_PREFERRED_SCHEME_API:\n+        return sysconfig.get_preferred_scheme(\"user\")  # type: ignore\n     if is_osx_framework() and not running_under_virtualenv():\n         suffixed = \"osx_framework_user\"\n     else:\n@@ -70,6 +76,8 @@\n \n def _infer_home() -> str:\n     \"\"\"Try to find a home for the current platform.\"\"\"\n+    if _HAS_PREFERRED_SCHEME_API:\n+        return sysconfig.get_preferred_scheme(\"home\")  # type: ignore\n     suffixed = f\"{os.name}_home\"\n     if suffixed in _AVAILABLE_SCHEMES:\n         return suffixed\n", "issue": "Use sysconfig.get_preferred_scheme etc.\nTodo to self. This has been implemented for 3.10 and we should support is in 21.2.\n", "before_files": [{"content": "import distutils.util  # FIXME: For change_root.\nimport logging\nimport os\nimport sys\nimport sysconfig\nimport typing\n\nfrom pip._internal.exceptions import InvalidSchemeCombination, UserInstallationInvalid\nfrom pip._internal.models.scheme import SCHEME_KEYS, Scheme\nfrom pip._internal.utils.virtualenv import running_under_virtualenv\n\nfrom .base import get_major_minor_version, is_osx_framework\n\nlogger = logging.getLogger(__name__)\n\n\n# Notes on _infer_* functions.\n# Unfortunately ``_get_default_scheme()`` is private, so there's no way to\n# ask things like \"what is the '_prefix' scheme on this platform\". These\n# functions try to answer that with some heuristics while accounting for ad-hoc\n# platforms not covered by CPython's default sysconfig implementation. If the\n# ad-hoc implementation does not fully implement sysconfig, we'll fall back to\n# a POSIX scheme.\n\n_AVAILABLE_SCHEMES = set(sysconfig.get_scheme_names())\n\n\ndef _infer_prefix() -> str:\n    \"\"\"Try to find a prefix scheme for the current platform.\n\n    This tries:\n\n    * A special ``osx_framework_library`` for Python distributed by Apple's\n      Command Line Tools, when not running in a virtual environment.\n    * Implementation + OS, used by PyPy on Windows (``pypy_nt``).\n    * Implementation without OS, used by PyPy on POSIX (``pypy``).\n    * OS + \"prefix\", used by CPython on POSIX (``posix_prefix``).\n    * Just the OS name, used by CPython on Windows (``nt``).\n\n    If none of the above works, fall back to ``posix_prefix``.\n    \"\"\"\n    os_framework_global = is_osx_framework() and not running_under_virtualenv()\n    if os_framework_global and \"osx_framework_library\" in _AVAILABLE_SCHEMES:\n        return \"osx_framework_library\"\n    implementation_suffixed = f\"{sys.implementation.name}_{os.name}\"\n    if implementation_suffixed in _AVAILABLE_SCHEMES:\n        return implementation_suffixed\n    if sys.implementation.name in _AVAILABLE_SCHEMES:\n        return sys.implementation.name\n    suffixed = f\"{os.name}_prefix\"\n    if suffixed in _AVAILABLE_SCHEMES:\n        return suffixed\n    if os.name in _AVAILABLE_SCHEMES:  # On Windows, prefx is just called \"nt\".\n        return os.name\n    return \"posix_prefix\"\n\n\ndef _infer_user() -> str:\n    \"\"\"Try to find a user scheme for the current platform.\"\"\"\n    if is_osx_framework() and not running_under_virtualenv():\n        suffixed = \"osx_framework_user\"\n    else:\n        suffixed = f\"{os.name}_user\"\n    if suffixed in _AVAILABLE_SCHEMES:\n        return suffixed\n    if \"posix_user\" not in _AVAILABLE_SCHEMES:  # User scheme unavailable.\n        raise UserInstallationInvalid()\n    return \"posix_user\"\n\n\ndef _infer_home() -> str:\n    \"\"\"Try to find a home for the current platform.\"\"\"\n    suffixed = f\"{os.name}_home\"\n    if suffixed in _AVAILABLE_SCHEMES:\n        return suffixed\n    return \"posix_home\"\n\n\n# Update these keys if the user sets a custom home.\n_HOME_KEYS = [\n    \"installed_base\",\n    \"base\",\n    \"installed_platbase\",\n    \"platbase\",\n    \"prefix\",\n    \"exec_prefix\",\n]\nif sysconfig.get_config_var(\"userbase\") is not None:\n    _HOME_KEYS.append(\"userbase\")\n\n\ndef get_scheme(\n    dist_name: str,\n    user: bool = False,\n    home: typing.Optional[str] = None,\n    root: typing.Optional[str] = None,\n    isolated: bool = False,\n    prefix: typing.Optional[str] = None,\n) -> Scheme:\n    \"\"\"\n    Get the \"scheme\" corresponding to the input parameters.\n\n    :param dist_name: the name of the package to retrieve the scheme for, used\n        in the headers scheme path\n    :param user: indicates to use the \"user\" scheme\n    :param home: indicates to use the \"home\" scheme\n    :param root: root under which other directories are re-based\n    :param isolated: ignored, but kept for distutils compatibility (where\n        this controls whether the user-site pydistutils.cfg is honored)\n    :param prefix: indicates to use the \"prefix\" scheme and provides the\n        base directory for the same\n    \"\"\"\n    if user and prefix:\n        raise InvalidSchemeCombination(\"--user\", \"--prefix\")\n    if home and prefix:\n        raise InvalidSchemeCombination(\"--home\", \"--prefix\")\n\n    if home is not None:\n        scheme_name = _infer_home()\n    elif user:\n        scheme_name = _infer_user()\n    else:\n        scheme_name = _infer_prefix()\n\n    if home is not None:\n        variables = {k: home for k in _HOME_KEYS}\n    elif prefix is not None:\n        variables = {k: prefix for k in _HOME_KEYS}\n    else:\n        variables = {}\n\n    paths = sysconfig.get_paths(scheme=scheme_name, vars=variables)\n\n    # Logic here is very arbitrary, we're doing it for compatibility, don't ask.\n    # 1. Pip historically uses a special header path in virtual environments.\n    # 2. If the distribution name is not known, distutils uses 'UNKNOWN'. We\n    #    only do the same when not running in a virtual environment because\n    #    pip's historical header path logic (see point 1) did not do this.\n    if running_under_virtualenv():\n        if user:\n            base = variables.get(\"userbase\", sys.prefix)\n        else:\n            base = variables.get(\"base\", sys.prefix)\n        python_xy = f\"python{get_major_minor_version()}\"\n        paths[\"include\"] = os.path.join(base, \"include\", \"site\", python_xy)\n    elif not dist_name:\n        dist_name = \"UNKNOWN\"\n\n    scheme = Scheme(\n        platlib=paths[\"platlib\"],\n        purelib=paths[\"purelib\"],\n        headers=os.path.join(paths[\"include\"], dist_name),\n        scripts=paths[\"scripts\"],\n        data=paths[\"data\"],\n    )\n    if root is not None:\n        for key in SCHEME_KEYS:\n            value = distutils.util.change_root(root, getattr(scheme, key))\n            setattr(scheme, key, value)\n    return scheme\n\n\ndef get_bin_prefix() -> str:\n    # Forcing to use /usr/local/bin for standard macOS framework installs.\n    if sys.platform[:6] == \"darwin\" and sys.prefix[:16] == \"/System/Library/\":\n        return \"/usr/local/bin\"\n    return sysconfig.get_paths()[\"scripts\"]\n\n\ndef get_purelib() -> str:\n    return sysconfig.get_paths()[\"purelib\"]\n\n\ndef get_platlib() -> str:\n    return sysconfig.get_paths()[\"platlib\"]\n\n\ndef get_prefixed_libs(prefix: str) -> typing.Tuple[str, str]:\n    paths = sysconfig.get_paths(vars={\"base\": prefix, \"platbase\": prefix})\n    return (paths[\"purelib\"], paths[\"platlib\"])\n", "path": "src/pip/_internal/locations/_sysconfig.py"}], "after_files": [{"content": "import distutils.util  # FIXME: For change_root.\nimport logging\nimport os\nimport sys\nimport sysconfig\nimport typing\n\nfrom pip._internal.exceptions import InvalidSchemeCombination, UserInstallationInvalid\nfrom pip._internal.models.scheme import SCHEME_KEYS, Scheme\nfrom pip._internal.utils.virtualenv import running_under_virtualenv\n\nfrom .base import get_major_minor_version, is_osx_framework\n\nlogger = logging.getLogger(__name__)\n\n\n# Notes on _infer_* functions.\n# Unfortunately ``_get_default_scheme()`` is private, so there's no way to\n# ask things like \"what is the '_prefix' scheme on this platform\". These\n# functions try to answer that with some heuristics while accounting for ad-hoc\n# platforms not covered by CPython's default sysconfig implementation. If the\n# ad-hoc implementation does not fully implement sysconfig, we'll fall back to\n# a POSIX scheme.\n\n_AVAILABLE_SCHEMES = set(sysconfig.get_scheme_names())\n\n_HAS_PREFERRED_SCHEME_API = sys.version_info >= (3, 10)\n\n\ndef _infer_prefix() -> str:\n    \"\"\"Try to find a prefix scheme for the current platform.\n\n    This tries:\n\n    * A special ``osx_framework_library`` for Python distributed by Apple's\n      Command Line Tools, when not running in a virtual environment.\n    * Implementation + OS, used by PyPy on Windows (``pypy_nt``).\n    * Implementation without OS, used by PyPy on POSIX (``pypy``).\n    * OS + \"prefix\", used by CPython on POSIX (``posix_prefix``).\n    * Just the OS name, used by CPython on Windows (``nt``).\n\n    If none of the above works, fall back to ``posix_prefix``.\n    \"\"\"\n    if _HAS_PREFERRED_SCHEME_API:\n        return sysconfig.get_preferred_scheme(\"prefix\")  # type: ignore\n    os_framework_global = is_osx_framework() and not running_under_virtualenv()\n    if os_framework_global and \"osx_framework_library\" in _AVAILABLE_SCHEMES:\n        return \"osx_framework_library\"\n    implementation_suffixed = f\"{sys.implementation.name}_{os.name}\"\n    if implementation_suffixed in _AVAILABLE_SCHEMES:\n        return implementation_suffixed\n    if sys.implementation.name in _AVAILABLE_SCHEMES:\n        return sys.implementation.name\n    suffixed = f\"{os.name}_prefix\"\n    if suffixed in _AVAILABLE_SCHEMES:\n        return suffixed\n    if os.name in _AVAILABLE_SCHEMES:  # On Windows, prefx is just called \"nt\".\n        return os.name\n    return \"posix_prefix\"\n\n\ndef _infer_user() -> str:\n    \"\"\"Try to find a user scheme for the current platform.\"\"\"\n    if _HAS_PREFERRED_SCHEME_API:\n        return sysconfig.get_preferred_scheme(\"user\")  # type: ignore\n    if is_osx_framework() and not running_under_virtualenv():\n        suffixed = \"osx_framework_user\"\n    else:\n        suffixed = f\"{os.name}_user\"\n    if suffixed in _AVAILABLE_SCHEMES:\n        return suffixed\n    if \"posix_user\" not in _AVAILABLE_SCHEMES:  # User scheme unavailable.\n        raise UserInstallationInvalid()\n    return \"posix_user\"\n\n\ndef _infer_home() -> str:\n    \"\"\"Try to find a home for the current platform.\"\"\"\n    if _HAS_PREFERRED_SCHEME_API:\n        return sysconfig.get_preferred_scheme(\"home\")  # type: ignore\n    suffixed = f\"{os.name}_home\"\n    if suffixed in _AVAILABLE_SCHEMES:\n        return suffixed\n    return \"posix_home\"\n\n\n# Update these keys if the user sets a custom home.\n_HOME_KEYS = [\n    \"installed_base\",\n    \"base\",\n    \"installed_platbase\",\n    \"platbase\",\n    \"prefix\",\n    \"exec_prefix\",\n]\nif sysconfig.get_config_var(\"userbase\") is not None:\n    _HOME_KEYS.append(\"userbase\")\n\n\ndef get_scheme(\n    dist_name: str,\n    user: bool = False,\n    home: typing.Optional[str] = None,\n    root: typing.Optional[str] = None,\n    isolated: bool = False,\n    prefix: typing.Optional[str] = None,\n) -> Scheme:\n    \"\"\"\n    Get the \"scheme\" corresponding to the input parameters.\n\n    :param dist_name: the name of the package to retrieve the scheme for, used\n        in the headers scheme path\n    :param user: indicates to use the \"user\" scheme\n    :param home: indicates to use the \"home\" scheme\n    :param root: root under which other directories are re-based\n    :param isolated: ignored, but kept for distutils compatibility (where\n        this controls whether the user-site pydistutils.cfg is honored)\n    :param prefix: indicates to use the \"prefix\" scheme and provides the\n        base directory for the same\n    \"\"\"\n    if user and prefix:\n        raise InvalidSchemeCombination(\"--user\", \"--prefix\")\n    if home and prefix:\n        raise InvalidSchemeCombination(\"--home\", \"--prefix\")\n\n    if home is not None:\n        scheme_name = _infer_home()\n    elif user:\n        scheme_name = _infer_user()\n    else:\n        scheme_name = _infer_prefix()\n\n    if home is not None:\n        variables = {k: home for k in _HOME_KEYS}\n    elif prefix is not None:\n        variables = {k: prefix for k in _HOME_KEYS}\n    else:\n        variables = {}\n\n    paths = sysconfig.get_paths(scheme=scheme_name, vars=variables)\n\n    # Logic here is very arbitrary, we're doing it for compatibility, don't ask.\n    # 1. Pip historically uses a special header path in virtual environments.\n    # 2. If the distribution name is not known, distutils uses 'UNKNOWN'. We\n    #    only do the same when not running in a virtual environment because\n    #    pip's historical header path logic (see point 1) did not do this.\n    if running_under_virtualenv():\n        if user:\n            base = variables.get(\"userbase\", sys.prefix)\n        else:\n            base = variables.get(\"base\", sys.prefix)\n        python_xy = f\"python{get_major_minor_version()}\"\n        paths[\"include\"] = os.path.join(base, \"include\", \"site\", python_xy)\n    elif not dist_name:\n        dist_name = \"UNKNOWN\"\n\n    scheme = Scheme(\n        platlib=paths[\"platlib\"],\n        purelib=paths[\"purelib\"],\n        headers=os.path.join(paths[\"include\"], dist_name),\n        scripts=paths[\"scripts\"],\n        data=paths[\"data\"],\n    )\n    if root is not None:\n        for key in SCHEME_KEYS:\n            value = distutils.util.change_root(root, getattr(scheme, key))\n            setattr(scheme, key, value)\n    return scheme\n\n\ndef get_bin_prefix() -> str:\n    # Forcing to use /usr/local/bin for standard macOS framework installs.\n    if sys.platform[:6] == \"darwin\" and sys.prefix[:16] == \"/System/Library/\":\n        return \"/usr/local/bin\"\n    return sysconfig.get_paths()[\"scripts\"]\n\n\ndef get_purelib() -> str:\n    return sysconfig.get_paths()[\"purelib\"]\n\n\ndef get_platlib() -> str:\n    return sysconfig.get_paths()[\"platlib\"]\n\n\ndef get_prefixed_libs(prefix: str) -> typing.Tuple[str, str]:\n    paths = sysconfig.get_paths(vars={\"base\": prefix, \"platbase\": prefix})\n    return (paths[\"purelib\"], paths[\"platlib\"])\n", "path": "src/pip/_internal/locations/_sysconfig.py"}]}