Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make easy_install command less strict (fixes #1405) #1941

Merged
merged 3 commits into from
Feb 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog.d/1941.change.rst
Original file line number Diff line number Diff line change
@@ -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.
23 changes: 10 additions & 13 deletions setuptools/command/easy_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -273,6 +270,9 @@ def finalize_options(self):
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()
Expand Down Expand Up @@ -479,8 +479,9 @@ def check_site_dir(self):
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:
Expand Down Expand Up @@ -1311,10 +1312,6 @@ def byte_compile(self, to_compile):
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"""

Expand Down