diff options
| author | Christophe Simonis <christophe@tinyerp.com> | 2008-09-08 09:52:51 +0200 |
|---|---|---|
| committer | Christophe Simonis <christophe@tinyerp.com> | 2008-09-08 09:52:51 +0200 |
| commit | b7fbf0aa7298ed130a3c7d0fcdd810dbc99a169a (patch) | |
| tree | 4f291da2533aa0fe0069913239e6a54d11216308 /bin/tools/misc.py | |
| parent | f1c9e258a44d3f302d59a18c63f6afa4ffade08a (diff) | |
fix with code source walking in translation export
bzr revid: christophe@tinyerp.com-20080908075251-gbr4dp0vyl5dhv9u
Diffstat (limited to 'bin/tools/misc.py')
| -rw-r--r-- | bin/tools/misc.py | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/bin/tools/misc.py b/bin/tools/misc.py index cbca190fd04..4d9458206f4 100644 --- a/bin/tools/misc.py +++ b/bin/tools/misc.py @@ -257,20 +257,21 @@ def file_open(name, mode="r", subdir='addons', pathinfo=False): def oswalksymlinks(top, topdown=True, onerror=None): - """ - same as os.walk but follow symlinks - """ - for dirpath, dirnames, filenames in os.walk(top, topdown, onerror): - symlinks = filter(lambda dirname: os.path.islink(os.path.join(dirpath, dirname)), dirnames) - if not topdown: - for s in symlinks: - for x in oswalksymlinks(os.path.join(dirpath, s), topdown, onerror): - yield x - yield dirpath, dirnames, filenames - if topdown: - for s in symlinks: - for x in oswalksymlinks(os.path.join(dirpath, s), topdown, onerror): - yield x + """ + same as os.walk but follow symlinks + attention: all symlinks are walked before all normals directories + """ + for dirpath, dirnames, filenames in os.walk(top, topdown, onerror): + if topdown: + yield dirpath, dirnames, filenames + + symlinks = filter(lambda dirname: os.path.islink(os.path.join(dirpath, dirname)), dirnames) + for s in symlinks: + for x in oswalksymlinks(os.path.join(dirpath, s), topdown, onerror): + yield x + + if not topdown: + yield dirpath, dirnames, filenames #---------------------------------------------------------- # iterables |
