diff options
| author | Christophe Simonis <christophe@tinyerp.com> | 2008-09-05 01:50:01 +0200 |
|---|---|---|
| committer | Christophe Simonis <christophe@tinyerp.com> | 2008-09-05 01:50:01 +0200 |
| commit | 6fbedbf2e57b67e45eeff902db4bba2a48d9b695 (patch) | |
| tree | 7276ae40d7d2e3d9d211d644306b747c47020a23 /bin | |
| parent | e1c774f5db7467500c8bce05444a82afc8c3bc4c (diff) | |
add (and use) method tools.oswalksymlinks
bzr revid: christophe@tinyerp.com-20080904235001-3ix8x19mcdobihwo
Diffstat (limited to 'bin')
| -rw-r--r-- | bin/tools/misc.py | 16 | ||||
| -rw-r--r-- | bin/tools/translate.py | 2 |
2 files changed, 17 insertions, 1 deletions
diff --git a/bin/tools/misc.py b/bin/tools/misc.py index 32d58ff5ae1..cbca190fd04 100644 --- a/bin/tools/misc.py +++ b/bin/tools/misc.py @@ -256,6 +256,22 @@ def file_open(name, mode="r", subdir='addons', pathinfo=False): raise IOError, 'File not found : '+str(name) +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 + #---------------------------------------------------------- # iterables #---------------------------------------------------------- diff --git a/bin/tools/translate.py b/bin/tools/translate.py index 9ac392290bf..d81365b3c9b 100644 --- a/bin/tools/translate.py +++ b/bin/tools/translate.py @@ -442,7 +442,7 @@ def trans_generate(lang, modules, dbname=None): return 'base' # files that are not in a module are considered as being in 'base' module modobj = pool.get('ir.module.module') - for root, dirs, files in os.walk(tools.config['root_path']): + for root, dirs, files in tools.oswalksymlinks(tools.config['root_path']): for fname in fnmatch.filter(files, '*.py'): fabsolutepath = join(root, fname) frelativepath = fabsolutepath[len(tools.config['root_path'])+1:] |
