diff options
| -rw-r--r-- | CHANGES.txt | 2 | ||||
| -rwxr-xr-x | setuptools/command/easy_install.py | 8 | ||||
| -rw-r--r-- | setuptools/tests/test_easy_install.py | 40 |
3 files changed, 48 insertions, 2 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index b27b9b13..e6d2a678 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -15,6 +15,8 @@ CHANGES * 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 diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index de6ea945..fb8cd74f 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -1674,7 +1674,6 @@ def bootstrap(): 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 @@ -1699,9 +1698,16 @@ usage: %(script)s [options] requirement_or_url ... 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:] diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py index 6ce20e42..95909ca7 100644 --- a/setuptools/tests/test_easy_install.py +++ b/setuptools/tests/test_easy_install.py @@ -2,7 +2,7 @@ """ 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): @@ -27,6 +27,12 @@ if __name__ == '__main__': ) """ % sys.executable +SETUP_PY = """\ +from setuptools import setup + +setup(name='foo') +""" + class TestEasyInstallTest(unittest.TestCase): def test_install_site_py(self): @@ -52,3 +58,35 @@ class TestEasyInstallTest(unittest.TestCase): 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) + |
