Commit 1030b3c6 authored by Reinout van Rees's avatar Reinout van Rees

In-place editing of os.walk results

The [:] is necessary to edit the os.walk results in-place. Otherwise the
filtering-out of .svn, CVS and so doesn't work as intended.
(Note: this regression I put in was caught by one of the tests! Good that
we've got such a large amount of tests!)
parent be8bc821
......@@ -1602,7 +1602,7 @@ def _open(base, filename, seen, dl_options, override, downloaded):
return result
ignore_directories = u'.svn', u'CVS', u'__pycache__'
ignore_directories = '.svn', 'CVS', '__pycache__'
_dir_hashes = {}
def _dir_hash(dir):
dir = fs_to_text(dir)
......@@ -1613,8 +1613,8 @@ def _dir_hash(dir):
return dir_hash
hash = md5()
for (dirpath, dirnames, filenames) in os.walk(dir):
dirnames = [fs_to_text(dirname) for dirname in dirnames]
filenames = [fs_to_text(filename) for filename in filenames]
dirnames[:] = [fs_to_text(dirname) for dirname in dirnames]
filenames[:] = [fs_to_text(filename) for filename in filenames]
dirnames[:] = sorted(n for n in dirnames if n not in ignore_directories)
filenames[:] = sorted(f for f in filenames
if (not (f.endswith('pyc') or f.endswith('pyo'))
......
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