Commits

Anonymous committed bdbddd9

easy_install doesn't use a setup.cfg located in the working dir - fixes #99

Comments (0)

Files changed (3)

 * Issue 80: test_develop now works with Python 3.1
 * Issue 93: upload_docs now works if there is an empty sub-directory.
 * Issue 70: exec bit on non-exec files
+* Issue 99: now easy_install doesn't usesa  "setup.cfg" if any exists in
+  the working directory.
 
 -----
 0.6.8

setuptools/command/easy_install.py

     import setuptools; argv0 = os.path.dirname(setuptools.__path__[0])
     sys.argv[0] = argv0; sys.argv.append(argv0); main()
 
-
 def main(argv=None, **kw):
     from setuptools import setup
     from setuptools.dist import Distribution
 
     class DistributionWithoutHelpCommands(Distribution):
         common_usage = ""
+
         def _show_help(self,*args,**kw):
             with_ei_usage(lambda: Distribution._show_help(self,*args,**kw))
 
+        def find_config_files(self):
+            files = Distribution.find_config_files(self)
+            if 'setup.cfg' in files:
+                files.remove('setup.cfg')
+            return files
+
     if argv is None:
         argv = sys.argv[1:]
 

setuptools/tests/test_easy_install.py

 """
 import sys
 import os, shutil, tempfile, unittest
-from setuptools.command.easy_install import easy_install, get_script_args
+from setuptools.command.easy_install import easy_install, get_script_args, main
 from setuptools.dist import Distribution
 
 class FakeDist(object):
     )
 """ % sys.executable
 
+SETUP_PY = """\
+from setuptools import setup
+
+setup(name='foo')
+"""
+
 class TestEasyInstallTest(unittest.TestCase):
 
     def test_install_site_py(self):
 
         self.assertEquals(script, WANTED)
 
+    def test_no_setup_cfg(self):
+        # makes sure easy_install as a command (main)
+        # doesn't use a setup.cfg file that is located
+        # in the current working directory
+        dir = tempfile.mkdtemp()
+        setup_cfg = open(os.path.join(dir, 'setup.cfg'), 'w')
+        setup_cfg.write('[easy_install]\nfind_links = http://example.com')
+        setup_cfg.close()
+        setup_py = open(os.path.join(dir, 'setup.py'), 'w')
+        setup_py.write(SETUP_PY)
+        setup_py.close()
+
+        from setuptools.dist import Distribution
+
+        def _parse_command_line(self):
+            msg = 'Error: a local setup.cfg was used'
+            opts = self.command_options
+            if 'easy_install' in opts:
+                assert 'find_links' not in opts['easy_install'], msg
+            return self._old_parse_command_line
+
+        Distribution._old_parse_command_line = Distribution.parse_command_line
+        Distribution.parse_command_line = _parse_command_line
+
+        old_wd = os.getcwd()
+        try:
+            os.chdir(dir)
+            main([])
+        finally:
+            os.chdir(old_wd)
+            shutil.rmtree(dir)
+