diff options
-rw-r--r-- | changelog.d/1941.change.rst | 4 | ||||
-rw-r--r-- | setuptools/command/easy_install.py | 23 |
2 files changed, 14 insertions, 13 deletions
diff --git a/changelog.d/1941.change.rst b/changelog.d/1941.change.rst new file mode 100644 index 00000000..a41cdcfe --- /dev/null +++ b/changelog.d/1941.change.rst @@ -0,0 +1,4 @@ +Improve editable installs with PEP 518 build isolation: + +* The ``--user`` option is now always available. A warning is issued if the user site directory is not available. +* The error shown when the install directory is not in ``PYTHONPATH`` has been turned into a warning. diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index b95ef1f6..abca1ae1 100644 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -157,19 +157,16 @@ class easy_install(Command): "allow building eggs from local checkouts"), ('version', None, "print version information and exit"), ('no-find-links', None, - "Don't load find-links defined in packages being installed") + "Don't load find-links defined in packages being installed"), + ('user', None, "install in user site-package '%s'" % site.USER_SITE) ] boolean_options = [ 'zip-ok', 'multi-version', 'exclude-scripts', 'upgrade', 'always-copy', 'editable', - 'no-deps', 'local-snapshots-ok', 'version' + 'no-deps', 'local-snapshots-ok', 'version', + 'user' ] - if site.ENABLE_USER_SITE: - help_msg = "install in user site-package '%s'" % site.USER_SITE - user_options.append(('user', None, help_msg)) - boolean_options.append('user') - negative_opt = {'always-unzip': 'zip-ok'} create_index = PackageIndex @@ -273,6 +270,9 @@ class easy_install(Command): self.config_vars['userbase'] = self.install_userbase self.config_vars['usersite'] = self.install_usersite + elif self.user: + log.warn("WARNING: The user site-packages directory is disabled.") + self._fix_install_dir_for_user_site() self.expand_basedirs() @@ -479,8 +479,9 @@ class easy_install(Command): self.cant_write_to_target() if not is_site_dir and not self.multi_version: - # Can't install non-multi to non-site dir - raise DistutilsError(self.no_default_version_msg()) + # Can't install non-multi to non-site dir with easy_install + pythonpath = os.environ.get('PYTHONPATH', '') + log.warn(self.__no_default_msg, self.install_dir, pythonpath) if is_site_dir: if self.pth_file is None: @@ -1311,10 +1312,6 @@ class easy_install(Command): Please make the appropriate changes for your system and try again. """).strip() - def no_default_version_msg(self): - template = self.__no_default_msg - return template % (self.install_dir, os.environ.get('PYTHONPATH', '')) - def install_site_py(self): """Make sure there's a site.py in the target dir, if needed""" |