Skip to content

Commit

Permalink
Remove easy_install.HAS_USER_SITE and just defer to site.ENABLE_USER_…
Browse files Browse the repository at this point in the history
…SITE.
  • Loading branch information
jaraco committed Nov 27, 2013
1 parent 57bf0b9 commit d52f186
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
3 changes: 3 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ CHANGES

* Issue #41: Dropped support for Python 2.4 and Python 2.5. Clients requiring
setuptools for those versions of Python should use setuptools 1.x.
* Removed ``setuptools.command.easy_install.HAS_USER_SITE``. Clients
expecting this boolean variable should use ``site.ENABLE_USER_SITE``
instead.

-----
1.4.1
Expand Down
14 changes: 6 additions & 8 deletions setuptools/command/easy_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@
'main', 'get_exe_prefixes',
]

HAS_USER_SITE = not sys.version < "2.6" and site.ENABLE_USER_SITE

def is_64bit():
return struct.calcsize("P") == 8

Expand Down Expand Up @@ -134,7 +132,7 @@ class easy_install(Command):
'no-deps', 'local-snapshots-ok', 'version'
]

if HAS_USER_SITE:
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')
Expand All @@ -143,7 +141,7 @@ class easy_install(Command):
create_index = PackageIndex

def initialize_options(self):
if HAS_USER_SITE:
if site.ENABLE_USER_SITE:
whereami = os.path.abspath(__file__)
self.user = whereami.startswith(site.USER_SITE)
else:
Expand All @@ -168,7 +166,7 @@ def initialize_options(self):
self.install_data = None
self.install_base = None
self.install_platbase = None
if HAS_USER_SITE:
if site.ENABLE_USER_SITE:
self.install_userbase = site.USER_BASE
self.install_usersite = site.USER_SITE
else:
Expand Down Expand Up @@ -226,13 +224,13 @@ def finalize_options(self):
'abiflags': getattr(sys, 'abiflags', ''),
}

if HAS_USER_SITE:
if site.ENABLE_USER_SITE:
self.config_vars['userbase'] = self.install_userbase
self.config_vars['usersite'] = self.install_usersite

# fix the install_dir if "--user" was used
#XXX: duplicate of the code in the setup command
if self.user and HAS_USER_SITE:
if self.user and site.ENABLE_USER_SITE:
self.create_home_path()
if self.install_userbase is None:
raise DistutilsPlatformError(
Expand Down Expand Up @@ -1278,7 +1276,7 @@ def get_site_dirs():
for site_lib in lib_paths:
if site_lib not in sitedirs: sitedirs.append(site_lib)

if HAS_USER_SITE:
if site.ENABLE_USER_SITE:
sitedirs.append(site.USER_SITE)

sitedirs = list(map(normalize_path, sitedirs))
Expand Down
8 changes: 4 additions & 4 deletions setuptools/tests/test_easy_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def setUp(self):
self.old_cwd = os.getcwd()
os.chdir(self.dir)
if sys.version >= "2.6":
self.old_has_site = easy_install_pkg.HAS_USER_SITE
self.old_enable_site = site.ENABLE_USER_SITE
self.old_file = easy_install_pkg.__file__
self.old_base = site.USER_BASE
site.USER_BASE = tempfile.mkdtemp()
Expand All @@ -157,11 +157,11 @@ def tearDown(self):
shutil.rmtree(site.USER_SITE)
site.USER_BASE = self.old_base
site.USER_SITE = self.old_site
easy_install_pkg.HAS_USER_SITE = self.old_has_site
site.ENABLE_USER_SITE = self.old_enable_site
easy_install_pkg.__file__ = self.old_file

def test_user_install_implied(self):
easy_install_pkg.HAS_USER_SITE = True # disabled sometimes
site.ENABLE_USER_SITE = True # disabled sometimes
#XXX: replace with something meaningfull
if sys.version < "2.6":
return #SKIP
Expand All @@ -178,7 +178,7 @@ def test_multiproc_atexit(self):
_LOG.info('this should not break')

def test_user_install_not_implied_without_usersite_enabled(self):
easy_install_pkg.HAS_USER_SITE = False # usually enabled
site.ENABLE_USER_SITE = False # usually enabled
#XXX: replace with something meaningfull
if sys.version < "2.6":
return #SKIP
Expand Down

0 comments on commit d52f186

Please sign in to comment.