diff options
author | Tarek Ziade <tarek@ziade.org> | 2010-04-07 10:00:46 +0200 |
---|---|---|
committer | Tarek Ziade <tarek@ziade.org> | 2010-04-07 10:00:46 +0200 |
commit | 4331740bfbdc6e148808375c406dab795ae43d9b (patch) | |
tree | 7bbf64311ba82b225b0a45099479e8b68b5df0d4 | |
parent | 4da7cdd3ea61af90e56e0cbe63811b8ef13cd484 (diff) | |
download | external_python_setuptools-4331740bfbdc6e148808375c406dab795ae43d9b.tar.gz external_python_setuptools-4331740bfbdc6e148808375c406dab795ae43d9b.tar.bz2 external_python_setuptools-4331740bfbdc6e148808375c406dab795ae43d9b.zip |
make sure we test that the directory exists before we install stuff asked by setup_requires fixes #138
--HG--
branch : distribute
extra : rebase_source : 1078501b886e4f0864b4ce84517b2fbc5399da35
-rw-r--r-- | CHANGES.txt | 1 | ||||
-rwxr-xr-x | setuptools/command/easy_install.py | 4 | ||||
-rw-r--r-- | setuptools/tests/test_develop.py | 21 |
3 files changed, 23 insertions, 3 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 8907fa22..e74f1714 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -16,6 +16,7 @@ CHANGES * Added easy_install --user * Issue 100: Fixed develop --user not taking '.' in PYTHONPATH into account * Issue 134: removed spurious UserWarnings. Patch by VanLindberg +* Issue 138: cant_write_to_target error when setup_requires is used. ------ 0.6.10 diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index 975f70e4..2d854755 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -462,7 +462,9 @@ Please make the appropriate changes for your system and try again. ok_exists = os.path.exists(ok_file) try: if ok_exists: os.unlink(ok_file) - os.makedirs(os.path.dirname(ok_file)) + dirname = os.path.dirname(ok_file) + if not os.path.exists(dirname): + os.makedirs(dirname) f = open(pth_file,'w') except (OSError,IOError): self.cant_write_to_target() diff --git a/setuptools/tests/test_develop.py b/setuptools/tests/test_develop.py index 10b2be9e..a567dd5a 100644 --- a/setuptools/tests/test_develop.py +++ b/setuptools/tests/test_develop.py @@ -6,6 +6,7 @@ import tempfile import site from StringIO import StringIO +from distutils.errors import DistutilsError from setuptools.command.develop import develop from setuptools.command import easy_install as easy_install_pkg from setuptools.dist import Distribution @@ -18,7 +19,7 @@ setup(name='foo') class TestDevelopTest(unittest.TestCase): - def setUp(self): + def setUp(self): self.dir = tempfile.mkdtemp() setup = os.path.join(self.dir, 'setup.py') f = open(setup, 'w') @@ -32,7 +33,7 @@ class TestDevelopTest(unittest.TestCase): self.old_site = site.USER_SITE site.USER_SITE = tempfile.mkdtemp() - def tearDown(self): + def tearDown(self): os.chdir(self.old_cwd) shutil.rmtree(self.dir) if sys.version >= "2.6": @@ -63,3 +64,19 @@ class TestDevelopTest(unittest.TestCase): content.sort() self.assertEquals(content, ['UNKNOWN.egg-link', 'easy-install.pth']) + def test_develop_with_setup_requires(self): + + wanted = ("Could not find suitable distribution for " + "Requirement.parse('I-DONT-EXIST')") + old_dir = os.getcwd() + os.chdir(self.dir) + try: + try: + dist = Distribution({'setup_requires': ['I_DONT_EXIST']}) + except DistutilsError, e: + error = str(e) + if error == wanted: + pass + finally: + os.chdir(old_dir) + |