Commits

Anonymous committed 4642b99

no_fake needs to be True by default fixes #74

Comments (0)

Files changed (3)

 0.6.7
 -----
 
+* Issue 74: no_fake should be True by default.
 
 -----
 0.6.6

distribute_setup.py

 
 
 def use_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
-                   to_dir=os.curdir, download_delay=15, no_fake=False):
+                   to_dir=os.curdir, download_delay=15, no_fake=True):
     # making sure we use the absolute path
     to_dir = os.path.abspath(to_dir)
     was_imported = 'pkg_resources' in sys.modules or \
             import pkg_resources
             if not hasattr(pkg_resources, '_distribute'):
                 if not no_fake:
-                    fake_setuptools()
+                    _fake_setuptools()
                 raise ImportError
         except ImportError:
             return _do_download(version, download_base, to_dir, download_delay)
             return _do_download(version, download_base, to_dir,
                                 download_delay)
     finally:
-        _create_fake_setuptools_pkg_info(to_dir)
+        if not no_fake:
+            _create_fake_setuptools_pkg_info(to_dir)
 
 def download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
                         to_dir=os.curdir, delay=15):
 
 def _before_install():
     log.warn('Before install bootstrap.')
-    fake_setuptools()
+    _fake_setuptools()
 
 
 def _under_prefix(location):
     return True
 
 
-def fake_setuptools():
+def _fake_setuptools():
     log.warn('Scanning installed packages')
     try:
         import pkg_resources

tests/test_distribute_setup.py

         distribute_setup.python_cmd = _faked
         _install(self.tarball)
 
+    def test_use_setuptools(self):
+        self.assertEquals(use_setuptools(), None)
+
+        # make sure fake_setuptools is not called by default
+        import pkg_resources
+        del pkg_resources._distribute
+        def fake_setuptools(*args):
+            raise AssertionError
+
+        pkg_resources._fake_setuptools = fake_setuptools
+        use_setuptools()
+
 if __name__ == '__main__':
     unittest.main()