diff options
-rw-r--r-- | CHANGES.txt | 3 | ||||
-rw-r--r-- | pkg_resources.py | 7 | ||||
-rw-r--r-- | setuptools/tests/test_resources.py | 19 |
3 files changed, 22 insertions, 7 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 73a10b36..3229a831 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -7,7 +7,8 @@ CHANGES ----- * Distribute no longer shadows setuptools if we require a 0.7-series - setuptools. + setuptools. And an error is raised when installing a 0.7 setuptools with + distribute. * When run from within buildout, no attempt is made to modify an existing setuptools egg, whether in a shared egg directory or a system setuptools. diff --git a/pkg_resources.py b/pkg_resources.py index 510be536..c0371864 100644 --- a/pkg_resources.py +++ b/pkg_resources.py @@ -2239,8 +2239,11 @@ class Distribution(object): loc = loc or self.location - # TODO: raise error if we're adding setuptools >= 0.7 as that is - # guaranteed to be incompatible with distribute. + if self.project_name == 'setuptools': + if '0.7' in self.version: + raise ValueError( + "A 0.7-series setuptools cannot be installed " + "with distribute") if not loc: return diff --git a/setuptools/tests/test_resources.py b/setuptools/tests/test_resources.py index c9236e88..6a89e8a8 100644 --- a/setuptools/tests/test_resources.py +++ b/setuptools/tests/test_resources.py @@ -187,10 +187,21 @@ class DistroTests(TestCase): ) self.assertRaises(UnknownExtra, d.requires, ["foo"]) - - - - + def testSetuptoolsDistributeCombination(self): + # Ensure that installing a 0.7-series setuptools fails. PJE says that + # it will not co-exist. + ws = WorkingSet([]) + d = Distribution( + "/some/path", + project_name="setuptools", + version="0.7a1") + self.assertRaises(ValueError, ws.add, d) + # A 0.6-series is no problem + d2 = Distribution( + "/some/path", + project_name="setuptools", + version="0.6c9") + ws.add(d2) |