diff options
author | Paul Sherwood <paul.sherwood@codethink.co.uk> | 2016-07-22 20:34:07 +0100 |
---|---|---|
committer | Paul Sherwood <paul.sherwood@codethink.co.uk> | 2016-07-22 20:34:07 +0100 |
commit | 0807e750ba912adc71f18fe6fdf2c34b58f610ac (patch) | |
tree | 40285179767b7ef3fc3f58ffcc01877acaaffa5d | |
parent | ca317958bf3e6b163b9edb0ba98f49e94cbabed1 (diff) | |
download | ybd-ps/218.tar.gz |
Another attempt fix 218ps/218
-rw-r--r-- | ybd/splitting.py | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/ybd/splitting.py b/ybd/splitting.py index 6c8e5fe..1f13690 100644 --- a/ybd/splitting.py +++ b/ybd/splitting.py @@ -198,26 +198,23 @@ def write_chunk_metafile(chunk): log(chunk['name'], 'Splitting', chunk.get('kind')) rules, splits = compile_rules(chunk) - install_dir = chunk['install'] - fs = OSFS(install_dir) - files = fs.walkfiles('.', search='depth') - dirs = fs.walkdirs('.', search='depth') - - for path in files: - for artifact, rule in rules: - if rule.match(path): - splits[artifact].append(path) - break - - all_files = [a for x in splits.values() for a in x] - for path in dirs: - if not any(map(lambda y: y.startswith(path), - all_files)) and path != '': - for artifact, rule in rules: + install = chunk['install'] + for root, dirs, files in os.walk(install.encode('UTF-8'), topdown=False): + for path in files: + for artifact, rule in rules: if rule.match(path) or rule.match(path + '/'): splits[artifact].append(path) break + all_files = [a for x in splits.values() for a in x] + for path in dirs: + if not any(map(lambda y: y.startswith(path), + all_files)) and path != '': + for artifact, rule in rules: + if rule.match(path) or rule.match(path + '/'): + splits[artifact].append(path) + break + write_metafile(rules, splits, chunk) |