File tree Expand file tree Collapse file tree 2 files changed +6
-9
lines changed
Expand file tree Collapse file tree 2 files changed +6
-9
lines changed Original file line number Diff line number Diff line change 1616def _patch_dist_in_site_packages (virtualenv : VirtualEnvironment ) -> None :
1717 # Since the tests are run from a virtualenv, and to avoid the "Will not
1818 # install to the usersite because it will lack sys.path precedence..."
19- # error: Monkey patch `pip._internal.req.req_install.dist_in_site_packages`
20- # and `pip._internal.utils.misc.dist_in_site_packages`
21- # so it's possible to install a conflicting distribution in the user site.
19+ # error: Monkey patch the Distribution class so it's possible to install a
20+ # conflicting distribution in the user site.
2221 virtualenv .sitecustomize = textwrap .dedent (
2322 """
2423 def dist_in_site_packages(dist):
2524 return False
2625
27- from pip._internal.req import req_install
28- from pip._internal.utils import misc
29- req_install.dist_in_site_packages = dist_in_site_packages
30- misc.dist_in_site_packages = dist_in_site_packages
26+ from pip._internal.metadata.base import BaseDistribution
27+ BaseDistribution.in_site_packages = property(dist_in_site_packages)
3128 """
3229 )
3330
Original file line number Diff line number Diff line change @@ -135,8 +135,8 @@ def patch_dist_in_site_packages(virtualenv: VirtualEnvironment) -> None:
135135 def dist_in_site_packages(dist):
136136 return False
137137
138- from pip._internal.utils import misc
139- misc.dist_in_site_packages = dist_in_site_packages
138+ from pip._internal.metadata.pkg_resources import Distribution
139+ Distribution.in_site_packages = property( dist_in_site_packages)
140140 """
141141 )
142142
You can’t perform that action at this time.
0 commit comments