diff options
author | Georgy Redkozubov <georgy.redkozubov@linaro.org> | 2012-12-05 18:35:12 +0400 |
---|---|---|
committer | Georgy Redkozubov <georgy.redkozubov@linaro.org> | 2012-12-05 18:35:12 +0400 |
commit | db3db16dc8c2eb53999fb15134cf6893af1fe7fc (patch) | |
tree | 5b81f96c73fc504871e54a4e19e9ca29bd5c7649 /scripts | |
parent | f4983fe1250336e2a68bc51592dfc545a3c22ee5 (diff) |
Added check if target/ dir exists
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/publish_to_snapshots.py | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/scripts/publish_to_snapshots.py b/scripts/publish_to_snapshots.py index d1128ea..e5f7809 100755 --- a/scripts/publish_to_snapshots.py +++ b/scripts/publish_to_snapshots.py @@ -267,25 +267,26 @@ class SnapshotsPublisher(object): def reshuffle_android_artifacts(self, src_dir): dst_dir = src_dir full_product_path = os.path.join(src_dir, product_dir_path) - filelist = os.listdir(full_product_path) - try: - for file in filelist: - src = os.path.join(full_product_path, file) - if os.path.isdir(src): - for artifact in os.listdir(src): - dest = os.path.join(dst_dir, artifact) - if os.path.exists(dest): - if os.path.isdir(dest): - continue - else: - os.remove(dest) - shutil.move(os.path.join(src, artifact), dest) - except shutil.Error: - print "Error while reshuffling the content" - try: - shutil.rmtree(os.path.dirname(full_product_path)) - except shutil.Error: - print "Error removing empty product dir" + if os.path.isdir(full_product_path): + filelist = os.listdir(full_product_path) + try: + for file in filelist: + src = os.path.join(full_product_path, file) + if os.path.isdir(src): + for artifact in os.listdir(src): + dest = os.path.join(dst_dir, artifact) + if os.path.exists(dest): + if os.path.isdir(dest): + continue + else: + os.remove(dest) + shutil.move(os.path.join(src, artifact), dest) + except shutil.Error: + print "Error while reshuffling the content" + try: + shutil.rmtree(os.path.dirname(full_product_path)) + except shutil.Error: + print "Error removing empty product dir" def move_dir_content(self, src_dir, dest_dir, sanitize=False): filelist = os.listdir(src_dir) |