[Checkins] SVN: zc.buildout/trunk/src/zc/buildout/ Bugs Fixed:

Jim Fulton jim at zope.com
Tue Oct 24 17:04:20 EDT 2006


Log message for revision 70900:
  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.
  

Changed:
  U   zc.buildout/trunk/src/zc/buildout/buildout.py
  U   zc.buildout/trunk/src/zc/buildout/easy_install.py
  U   zc.buildout/trunk/src/zc/buildout/tests.py

-=-
Modified: zc.buildout/trunk/src/zc/buildout/buildout.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/buildout.py	2006-10-24 17:55:34 UTC (rev 70899)
+++ zc.buildout/trunk/src/zc/buildout/buildout.py	2006-10-24 21:04:19 UTC (rev 70900)
@@ -276,7 +276,10 @@
         if install_parts:
             extra = [p for p in install_parts if p not in conf_parts]
             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
         else:
             install_parts = conf_parts
@@ -422,14 +425,6 @@
                     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()
                     try:
                         os.write(fd, runsetup_template % dict(
@@ -448,6 +443,14 @@
                             '-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(
                             os.P_WAIT, sys.executable, sys.executable,
                             *args) == 0

Modified: zc.buildout/trunk/src/zc/buildout/easy_install.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/easy_install.py	2006-10-24 17:55:34 UTC (rev 70899)
+++ zc.buildout/trunk/src/zc/buildout/easy_install.py	2006-10-24 21:04:19 UTC (rev 70900)
@@ -229,29 +229,31 @@
                             "Couln't download a distribution for %s."
                             % requirement)
 
-                    if always_unzip:
-                        should_unzip = True
+                    newloc = os.path.join(
+                        dest, os.path.basename(dist.location))
+
+                    if os.path.isdir(dist.location):
+                        # we got a directory. It must have been
+                        # obtained locally.  Jut copy it.
+                        shutil.copytree(dist.location, newloc)
                     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,
-                            os.path.join(dest, os.path.basename(dist.location)
-                                         ),
-                            )
-                    else:
-                        shutil.copyfile(
-                            dist.location,
-                            os.path.join(dest, os.path.basename(dist.location)
-                                         ),
-                            )
+                        if always_unzip:
+                            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:
                     shutil.rmtree(tmp)

Modified: zc.buildout/trunk/src/zc/buildout/tests.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/tests.py	2006-10-24 17:55:34 UTC (rev 70899)
+++ zc.buildout/trunk/src/zc/buildout/tests.py	2006-10-24 21:04:19 UTC (rev 70900)
@@ -52,6 +52,37 @@
 
     """
 
+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():
     r"""Buildout error handling
 
@@ -246,7 +277,62 @@
     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(
        os.path.dirname(
           os.path.dirname(



More information about the Checkins mailing list