[Checkins] SVN: zc.buildout/trunk/src/zc/buildout/ - Fixed a bug that would cause buildout to break while computing a

Sidnei da Silva sidnei at enfoldsystems.com
Wed Aug 13 13:18:37 EDT 2008


Log message for revision 89802:
  
  
  - Fixed a bug that would cause buildout to break while computing a
    directory hash if it found a broken symlink (Launchpad #250573)
  

Changed:
  U   zc.buildout/trunk/src/zc/buildout/buildout.py
  U   zc.buildout/trunk/src/zc/buildout/testing.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	2008-08-13 16:39:51 UTC (rev 89801)
+++ zc.buildout/trunk/src/zc/buildout/buildout.py	2008-08-13 17:18:36 UTC (rev 89802)
@@ -1187,7 +1187,8 @@
     for (dirpath, dirnames, filenames) in os.walk(dir):
         dirnames[:] = [n for n in dirnames if n not in ignore_directories]
         filenames[:] = [f for f in filenames
-                        if not (f.endswith('pyc') or f.endswith('pyo'))
+                        if (not (f.endswith('pyc') or f.endswith('pyo'))
+                            and os.path.exists(os.path.join(dirpath, f)))
                         ]
         hash.update(' '.join(dirnames))
         hash.update(' '.join(filenames))

Modified: zc.buildout/trunk/src/zc/buildout/testing.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/testing.py	2008-08-13 16:39:51 UTC (rev 89801)
+++ zc.buildout/trunk/src/zc/buildout/testing.py	2008-08-13 17:18:36 UTC (rev 89802)
@@ -47,6 +47,8 @@
     for name in names:
         if os.path.isdir(os.path.join(dir, name)):
             print 'd ',
+        elif os.path.islink(os.path.join(dir, name)):
+            print 'l ',
         else:
             print '- ',
         print name

Modified: zc.buildout/trunk/src/zc/buildout/tests.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/tests.py	2008-08-13 16:39:51 UTC (rev 89801)
+++ zc.buildout/trunk/src/zc/buildout/tests.py	2008-08-13 17:18:36 UTC (rev 89802)
@@ -1108,6 +1108,62 @@
 
     """
 
+def bug_250537_broken_symlink_doesnt_affect_sig():
+    """
+    
+If we have a develop recipe, it's signature shouldn't be affected by
+broken symlinks, and better yet, computing the hash should not break
+because of the missing target file.
+
+    >>> mkdir('recipe')
+    >>> write('recipe', 'setup.py',
+    ... '''
+    ... from setuptools import setup
+    ... setup(name='recipe',
+    ...       entry_points={'zc.buildout': ['default=foo:Foo']})
+    ... ''')
+    >>> write('recipe', 'foo.py',
+    ... '''
+    ... class Foo:
+    ...     def __init__(*args): pass
+    ...     def install(*args): return ()
+    ...     update = install
+    ... ''')
+    
+    >>> write('buildout.cfg',
+    ... '''
+    ... [buildout]
+    ... develop = recipe
+    ... parts = foo
+    ... 
+    ... [foo]
+    ... recipe = recipe
+    ... ''')
+
+
+    >>> print system(join(sample_buildout, 'bin', 'buildout')),
+    Develop: '/sample-buildout/recipe'
+    Installing foo.
+
+    >>> write('recipe', 'some-file', '1')
+    >>> os.symlink(join('recipe', 'some-file'), 
+    ...            join('recipe', 'another-file'))
+    >>> ls('recipe')
+    l  another-file
+    -  foo.py
+    -  foo.pyc
+    d  recipe.egg-info
+    -  setup.py
+    -  some-file
+
+    >>> remove('recipe', 'some-file')
+
+    >>> print system(join(sample_buildout, 'bin', 'buildout')),
+    Develop: '/sample-buildout/recipe'
+    Updating foo.
+
+    """
+
 def o_option_sets_offline():
     """
     >>> print system(join(sample_buildout, 'bin', 'buildout')+' -vvo'),



More information about the Checkins mailing list