Ronny Pfannschmidt avatar Ronny Pfannschmidt committed 90ae7b2 Merge

merge

Comments (0)

Files changed (2)

setuptools/command/easy_install.py

     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
 

setuptools/tests/test_easy_install.py

         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)
             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')
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.