Commit 67b9811d authored by tarek's avatar tarek

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

--HG--
branch : distribute
extra : rebase_source : 0ddcfcf2eb8ef650c248a1d5d86fe1b95100df10
parent 8159dbb1
......@@ -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
......
......@@ -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:]
......
......@@ -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)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment