diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index 107850a9f99..940c916f20d 100644 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -169,12 +169,8 @@ def initialize_options(self): self.install_data = None self.install_base = None self.install_platbase = None - if site.ENABLE_USER_SITE: - self.install_userbase = site.USER_BASE - self.install_usersite = site.USER_SITE - else: - self.install_userbase = None - self.install_usersite = None + self.install_userbase = site.USER_BASE + self.install_usersite = site.USER_SITE self.no_find_links = None # Options not specifiable via command line @@ -253,11 +249,9 @@ def finalize_options(self): # noqa: C901 # is too complex (25) # FIXME getattr(sys, 'windir', '').replace('.', ''), ) - if site.ENABLE_USER_SITE: - self.config_vars['userbase'] = self.install_userbase - self.config_vars['usersite'] = self.install_usersite - - elif self.user: + self.config_vars['userbase'] = self.install_userbase + self.config_vars['usersite'] = self.install_usersite + if self.user and not site.ENABLE_USER_SITE: log.warn("WARNING: The user site-packages directory is disabled.") self._fix_install_dir_for_user_site() @@ -373,7 +367,7 @@ def _fix_install_dir_for_user_site(self): """ Fix the install_dir if "--user" was used. """ - if not self.user or not site.ENABLE_USER_SITE: + if not self.user: return self.create_home_path() diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py index 328a989f6d1..1e0cfc8edde 100644 --- a/setuptools/tests/test_easy_install.py +++ b/setuptools/tests/test_easy_install.py @@ -1133,8 +1133,6 @@ def test_editable_install_honors_user_under_build_isolation(setup_context, monke ## Assert: # Should not install to sys.prefix - with pytest.raises(AssertionError): - assert sys_prefix.listdir() == [] - # Should install to site.USER_BASE - with pytest.raises(AssertionError): - assert (USER_BASE / 'lib').isdir() + assert sys_prefix.listdir() == [] + # Should install to site.USER_BASE: + assert (USER_BASE / 'lib').isdir()