Commit 039fb7be authored by Jim Fulton's avatar Jim Fulton

Bugs Fixed

----------

- We treat setuptools as a dependency of any distribution that
  (declares that it) uses namespace packages, whether it declares
  setuptools as a dependency or not.  This wasn't working for eggs
  intalled by virtue of being dependencies.
parent 01747fd6
......@@ -20,6 +20,18 @@ priorities include:
Change History
**************
1.0.0b12 (2006-10-?)
=====================
Bugs Fixed
----------
- We treat setuptools as a dependency of any distribution that
(declares that it) uses namespace packages, whether it declares
setuptools as a dependency or not. This wasn't working for eggs
intalled by virtue of being dependencies.
1.0.0b12 (2006-10-24)
=====================
......
......@@ -7,7 +7,7 @@ def read(*rnames):
name = "zc.buildout"
setup(
name = name,
version = "1.0.0b12",
version = "1.0.0b13",
author = "Jim Fulton",
author_email = "jim@zope.com",
description = "System for managing development buildouts",
......
......@@ -298,6 +298,27 @@ def _get_dist(requirement, env, ws,
links.append(link)
return dist
def _maybe_add_setuptools(ws, dist, env, dest, links, index, executable):
if dist.has_metadata('namespace_packages.txt'):
for r in dist.requires():
if r.project_name == 'setuptools':
break
else:
# We have a namespace package but no requirement for setuptools
if dist.precedence == pkg_resources.DEVELOP_DIST:
logger.warn(
"Develop distribution for %s\n"
"uses namespace packages but the distribution "
"does not require setuptools.",
dist)
requirement = pkg_resources.Requirement.parse('setuptools')
if ws.find(requirement) is None:
dist = _get_dist(requirement, env, ws,
dest, links, index, executable,
False)
ws.add(dist)
def install(specs, dest,
links=(), index=None,
......@@ -330,25 +351,8 @@ def install(specs, dest,
dist = _get_dist(requirement, env, ws,
dest, links, index, executable, always_unzip)
ws.add(dist)
if dist.has_metadata('namespace_packages.txt'):
for r in dist.requires():
if r.project_name == 'setuptools':
break
else:
# We have a namespace package but no requirement for setuptools
if dist.precedence == pkg_resources.DEVELOP_DIST:
logger.warn(
"Develop distribution for %s\n"
"uses namespace packages but the distribution "
"does not require setuptools.",
dist)
requirement = pkg_resources.Requirement.parse('setuptools')
if ws.find(requirement) is None:
dist = _get_dist(requirement, env, ws,
dest, links, index, executable,
False)
ws.add(dist)
_maybe_add_setuptools(ws, dist,
env, dest, links, index, executable)
# OK, we have the requested distributions and they're in the working
# set, but they may have unmet requirements. We'll simply keep
......@@ -365,9 +369,11 @@ def install(specs, dest,
[requirement] = err
if dest:
logger.debug('Getting required %s', requirement)
ws.add(_get_dist(requirement, env, ws,
dist = _get_dist(requirement, env, ws,
dest, links, index, executable, always_unzip)
)
ws.add(dist)
_maybe_add_setuptools(ws, dist,
env, dest, links, index, executable)
else:
break
......
......@@ -581,11 +581,9 @@ namespace packages. In this situation, package authors often forget to
declare setuptools as a dependency. This is a mistake, but,
unfortunately, a common one that we need to work around. If an egg
uses namespace packages and does not include setuptools as a depenency,
we willll still include setuptools in the working set. If we see this for
we will still include setuptools in the working set. If we see this for
a devlop egg, we will also generate a warning.
>>> cd(sample_buildout)
>>> mkdir('foo')
>>> mkdir('foo', 'src')
>>> mkdir('foo', 'src', 'stuff')
......@@ -664,8 +662,46 @@ We do not get a warning, but we do get setuptools included in the working set:
>>> print handler,
We get the same behavior if the it is a depedency that uses a
namespace package.
>>> mkdir('bar')
>>> write('bar', 'setup.py',
... """
... from setuptools import setup
... setup(name='bar', install_requires = ['foox'])
... """)
>>> write('bar', 'README.txt', '')
>>> write('buildout.cfg',
... """
... [buildout]
... develop = foo bar
... parts =
... """)
>>> print system(join('bin', 'buildout')),
buildout: Develop: /sample-buildout/foo/setup.py
buildout: Develop: /sample-buildout/bar/setup.py
>>> [dist.project_name
... for dist in zc.buildout.easy_install.working_set(
... ['bar'], sys.executable,
... [join(sample_buildout, 'eggs'),
... join(sample_buildout, 'develop-eggs'),
... ])]
['bar', 'foox', 'setuptools']
>>> print handler,
zc.buildout.easy_install WARNING
Develop distribution for foox 0.0.0
uses namespace packages but the distribution does not require setuptools.
>>> logging.getLogger('zc').propagate = True
>>> handler.uninstall()
'''
def create_sample_eggs(test, executable=sys.executable):
......
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