Commit a68f46f7 authored by Sidnei da Silva's avatar Sidnei da Silva

- Fixed a bug that would cause buildout to break while computing a
  directory hash if it found a broken symlink (Launchpad #250573)
parent 4586ec52
......@@ -1187,7 +1187,8 @@ def _dir_hash(dir):
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))
......
......@@ -47,6 +47,8 @@ def ls(dir, *subs):
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
......
......@@ -1108,6 +1108,62 @@ changes in .svn or CVS directories.
"""
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'),
......
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