Commit a54f140c authored by jim's avatar jim

Bugs Fixed:

`67737 <https://launchpad.net/products/zc.buildout/+bug/67737>`_
     Verbose and quite output options caused errors when the 
     develop buildout option was used to create develop eggs.

`67871 <https://launchpad.net/products/zc.buildout/+bug/67871>`_
     Installation failed if the source was a (local) unzipped
     egg.

`67873 <https://launchpad.net/products/zc.buildout/+bug/67873>`_
     There was an error in producing an error message when part names
     passed to the install command weren't included in the
     configuration.


git-svn-id: http://svn.zope.org/repos/main/zc.buildout/trunk@70900 62d5b8a3-27da-0310-9561-8e5933582275
parent a8566af4
...@@ -276,7 +276,10 @@ class Buildout(dict): ...@@ -276,7 +276,10 @@ class Buildout(dict):
if install_parts: if install_parts:
extra = [p for p in install_parts if p not in conf_parts] extra = [p for p in install_parts if p not in conf_parts]
if extra: if extra:
self._error('Invalid install parts:', *extra) self._error(
'Invalid install parts: %s.\n'
'Install parts must be listed in the configuration.',
' '.join(extra))
uninstall_missing = False uninstall_missing = False
else: else:
install_parts = conf_parts install_parts = conf_parts
...@@ -422,14 +425,6 @@ class Buildout(dict): ...@@ -422,14 +425,6 @@ class Buildout(dict):
self._logger.info("Develop: %s", setup) self._logger.info("Develop: %s", setup)
if self._log_level <= logging.DEBUG:
if self._log_level == logging.DEBUG:
del args[1]
else:
args[1] == '-v'
self._logger.debug("in: %s\n%r",
os.path.dirname(setup), args)
fd, tsetup = tempfile.mkstemp() fd, tsetup = tempfile.mkstemp()
try: try:
os.write(fd, runsetup_template % dict( os.write(fd, runsetup_template % dict(
...@@ -448,6 +443,14 @@ class Buildout(dict): ...@@ -448,6 +443,14 @@ class Buildout(dict):
'-d', zc.buildout.easy_install._safe_arg(dest), '-d', zc.buildout.easy_install._safe_arg(dest),
] ]
if self._log_level <= logging.DEBUG:
if self._log_level == logging.DEBUG:
del args[1]
else:
args[1] == '-v'
self._logger.debug("in: %s\n%r",
os.path.dirname(setup), args)
assert os.spawnl( assert os.spawnl(
os.P_WAIT, sys.executable, sys.executable, os.P_WAIT, sys.executable, sys.executable,
*args) == 0 *args) == 0
......
...@@ -229,29 +229,31 @@ def _get_dist(requirement, env, ws, ...@@ -229,29 +229,31 @@ def _get_dist(requirement, env, ws,
"Couln't download a distribution for %s." "Couln't download a distribution for %s."
% requirement) % requirement)
if always_unzip: newloc = os.path.join(
should_unzip = True dest, os.path.basename(dist.location))
else:
metadata = pkg_resources.EggMetadata( if os.path.isdir(dist.location):
zipimport.zipimporter(dist.location) # we got a directory. It must have been
) # obtained locally. Jut copy it.
should_unzip = ( shutil.copytree(dist.location, newloc)
metadata.has_metadata('not-zip-safe')
or not metadata.has_metadata('zip-safe')
)
if should_unzip:
setuptools.archive_util.unpack_archive(
dist.location,
os.path.join(dest, os.path.basename(dist.location)
),
)
else: else:
shutil.copyfile(
dist.location, if always_unzip:
os.path.join(dest, os.path.basename(dist.location) should_unzip = True
), else:
) metadata = pkg_resources.EggMetadata(
zipimport.zipimporter(dist.location)
)
should_unzip = (
metadata.has_metadata('not-zip-safe')
or not metadata.has_metadata('zip-safe')
)
if should_unzip:
setuptools.archive_util.unpack_archive(
dist.location, newloc)
else:
shutil.copyfile(dist.location, newloc)
finally: finally:
shutil.rmtree(tmp) shutil.rmtree(tmp)
......
...@@ -52,6 +52,37 @@ We should be able to deal with setup scripts that aren't setuptools based. ...@@ -52,6 +52,37 @@ We should be able to deal with setup scripts that aren't setuptools based.
""" """
def develop_verbose():
"""
We should be able to deal with setup scripts that aren't setuptools based.
>>> mkdir('foo')
>>> write('foo', 'setup.py',
... '''
... from setuptools import setup
... setup(name="foo")
... ''')
>>> write('buildout.cfg',
... '''
... [buildout]
... develop = foo
... parts =
... ''')
>>> print system(join('bin', 'buildout')+' -v'), # doctest: +ELLIPSIS
Configuration data:
...
buildout: Develop: /sample-buildout/foo/setup.py
...
Installed /sample-buildout/foo
...
>>> ls('develop-eggs')
- foo.egg-link
"""
def buildout_error_handling(): def buildout_error_handling():
r"""Buildout error handling r"""Buildout error handling
...@@ -246,6 +277,61 @@ uninstalling anything because the configuration hasn't changed. ...@@ -246,6 +277,61 @@ uninstalling anything because the configuration hasn't changed.
buildout: Updating debug buildout: Updating debug
""" """
def finding_eggs_as_local_directories():
r"""
It is possible to set up find-links so that we could install from
a local directory that may contained unzipped eggs.
>>> src = tmpdir('src')
>>> write(src, 'setup.py',
... '''
... from setuptools import setup
... setup(name='demo', py_modules=[''],
... zip_safe=False, version='1.0', author='bob', url='bob',
... author_email='bob')
... ''')
>>> write(src, 't.py', '#\n')
>>> write(src, 'README.txt', '')
>>> _ = system(join('bin', 'buildout')+' setup ' + src + ' bdist_egg')
Install it so it gets unzipped:
>>> d1 = tmpdir('d1')
>>> ws = zc.buildout.easy_install.install(
... ['demo'], d1, links=[join(src, 'dist')],
... )
>>> ls(d1)
d demo-1.0-py2.4.egg
Then try to install it again:
>>> d2 = tmpdir('d2')
>>> ws = zc.buildout.easy_install.install(
... ['demo'], d2, links=[d1],
... )
>>> ls(d2)
d demo-1.0-py2.4.egg
"""
def error_for_indefined_install_parts():
"""
Any parts we pass to install on the command line must be
listed in the configuration.
>>> print system(join('bin', 'buildout') + ' install foo'),
buildout: Invalid install parts: foo.
Install parts must be listed in the configuration.
>>> print system(join('bin', 'buildout') + ' install foo bar'),
buildout: Invalid install parts: foo bar.
Install parts must be listed in the configuration.
"""
bootstrap_py = os.path.join( bootstrap_py = os.path.join(
os.path.dirname( os.path.dirname(
......
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