aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>2010-05-19 16:21:25 +0200
committerRonny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>2010-05-19 16:21:25 +0200
commit7423fbf04e7c20b79c4c1304069b312355777a1f (patch)
tree63cef4604d8be11724d4d80f189c699071be7084
parent92f39994d2c6c711fbd73a5589d4de7b0ed1b72a (diff)
parent4fd89d186d4e968b7f5e99570b1e424d4c87148a (diff)
downloadexternal_python_setuptools-7423fbf04e7c20b79c4c1304069b312355777a1f.tar.gz
external_python_setuptools-7423fbf04e7c20b79c4c1304069b312355777a1f.tar.bz2
external_python_setuptools-7423fbf04e7c20b79c4c1304069b312355777a1f.zip
merge
--HG-- branch : distribute extra : rebase_source : fe09c40bed001a273328dbd39b764a784c6448eb
-rwxr-xr-xsetuptools/command/easy_install.py5
-rw-r--r--setuptools/tests/test_easy_install.py36
2 files changed, 22 insertions, 19 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index 8aab6f1e..d68943fa 100755
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -122,10 +122,9 @@ class easy_install(Command):
create_index = PackageIndex
def initialize_options(self):
- if HAS_USER_SITE:
+ if HAS_USER_SITE and site.ENABLE_USER_SITE:
whereami = os.path.abspath(__file__)
- self.user = (whereami.startswith(site.USER_SITE)
- or whereami.startswith(site.USER_BASE))
+ self.user = whereami.startswith(site.USER_SITE)
else:
self.user = 0
diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index 692982b3..4791e03c 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -158,10 +158,13 @@ class TestUserInstallTest(unittest.TestCase):
self.old_cwd = os.getcwd()
os.chdir(self.dir)
if sys.version >= "2.6":
+ self.old_enable = site.ENABLE_USER_SITE
+ self.old_file = easy_install_pkg.__file__
self.old_base = site.USER_BASE
site.USER_BASE = tempfile.mkdtemp()
self.old_site = site.USER_SITE
site.USER_SITE = tempfile.mkdtemp()
+ easy_install_pkg.__file__ = site.USER_SITE
def tearDown(self):
os.chdir(self.old_cwd)
@@ -171,33 +174,34 @@ class TestUserInstallTest(unittest.TestCase):
shutil.rmtree(site.USER_SITE)
site.USER_BASE = self.old_base
site.USER_SITE = self.old_site
+ site.ENABLE_USER_SITE = self.old_enable
+ easy_install_pkg.__file__ = self.old_file
- def test_install(self):
+ def test_user_install_implied(self):
+ site.ENABLE_USER_SITE = True # disabled sometimes
#XXX: replace with something meaningfull
- return
if sys.version < "2.6":
- return
+ return #SKIP
dist = Distribution()
dist.script_name = 'setup.py'
cmd = easy_install(dist)
- cmd.user = 1
cmd.args = ['py']
cmd.ensure_finalized()
- cmd.user = 1
- old_stdout = sys.stdout
- sys.stdout = StringIO()
- try:
- cmd.run()
- finally:
- sys.stdout = old_stdout
-
- # let's see if we got our egg link at the right place
- content = os.listdir(site.USER_SITE)
- content.sort()
- self.assertEquals(content, ['UNKNOWN.egg-link', 'easy-install.pth'])
+ self.assertTrue(cmd.user, 'user should be implied')
def test_multiproc_atexit(self):
if not _MULTIPROC:
return
_LOG.info('this should not break')
+ def test_user_install_not_implied_without_usersite_enabled(self):
+ site.ENABLE_USER_SITE = False # disabled sometimes
+ #XXX: replace with something meaningfull
+ if sys.version < "2.6":
+ return #SKIP
+ dist = Distribution()
+ dist.script_name = 'setup.py'
+ cmd = easy_install(dist)
+ cmd.args = ['py']
+ cmd.initialize_options()
+ self.assertFalse(cmd.user, 'NOT user should be implied')