Calling a generator from a generator didn't quite work.
Michal Ludvig authored on 2013/02/19 07:33:40... | ... |
@@ -48,16 +48,12 @@ def _fswalk_follow_symlinks(path): |
48 | 48 |
handle_exclude_include_walk(dirpath, dirnames, []) |
49 | 49 |
yield (dirpath, dirnames, filenames) |
50 | 50 |
|
51 |
-def _fswalk(path, follow_symlinks): |
|
51 |
+def _fswalk_no_symlinks(path): |
|
52 | 52 |
''' |
53 | 53 |
Directory tree generator |
54 | 54 |
|
55 | 55 |
path (str) is the root of the directory tree to walk |
56 |
- |
|
57 |
- follow_symlinks (bool) indicates whether to descend into symbolically linked directories |
|
58 | 56 |
''' |
59 |
- if follow_symlinks: |
|
60 |
- yield _fswalk_follow_symlinks(path) |
|
61 | 57 |
for dirpath, dirnames, filenames in os.walk(path): |
62 | 58 |
handle_exclude_include_walk(dirpath, dirnames, filenames) |
63 | 59 |
yield (dirpath, dirnames, filenames) |
... | ... |
@@ -155,7 +151,10 @@ def fetch_local_list(args, recursive = None): |
155 | 155 |
if local_uri.isdir(): |
156 | 156 |
local_base = deunicodise(local_uri.basename()) |
157 | 157 |
local_path = deunicodise(local_uri.path()) |
158 |
- filelist = _fswalk(local_path, cfg.follow_symlinks) |
|
158 |
+ if cfg.follow_symlinks: |
|
159 |
+ filelist = _fswalk_follow_symlinks(local_path) |
|
160 |
+ else: |
|
161 |
+ filelist = _fswalk_no_symlinks(local_path) |
|
159 | 162 |
single_file = False |
160 | 163 |
else: |
161 | 164 |
local_base = "" |
... | ... |
@@ -485,7 +485,7 @@ test_s3cmd("Put symbolic links", ['put', 'testsuite/etc/linked1.png', 's3://%s/x |
485 | 485 |
|
486 | 486 |
## ====== Sync symbolic links |
487 | 487 |
test_s3cmd("Sync symbolic links", ['sync', 'testsuite/', 's3://%s/xyz/' % bucket(1), '--no-encrypt', '--follow-symlinks' ], |
488 |
- must_find = ["File 'testsuite/etc/linked.png' stored as '%s/xyz/etc/linked.png'" % pbucket(1)], |
|
488 |
+ must_find = ["remote copy: etc2/Logo.PNG -> etc/linked.png"], |
|
489 | 489 |
# Don't want to recursively copy linked directories! |
490 | 490 |
must_not_find_re = ["etc/more/linked-dir/more/give-me-more.txt", |
491 | 491 |
"etc/brokenlink.png"], |