Mercurial > repos > yating-l > hubarchivecreator
annotate util/cleanDirectory.py @ 0:f493979f1408 draft default tip
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
author | yating-l |
---|---|
date | Wed, 21 Dec 2016 12:13:04 -0500 |
parents | |
children |
rev | line source |
---|---|
0
f493979f1408
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff
changeset
|
1 #!/usr/bin/python |
f493979f1408
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff
changeset
|
2 """Use to clean the directory after the run of HubArchiveCreator.py manually""" |
f493979f1408
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff
changeset
|
3 import os |
f493979f1408
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff
changeset
|
4 import shutil |
f493979f1408
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff
changeset
|
5 |
f493979f1408
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff
changeset
|
6 # Remove 'myHub.zip at root folder |
f493979f1408
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff
changeset
|
7 try: |
f493979f1408
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff
changeset
|
8 os.remove('myHub.zip') |
f493979f1408
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff
changeset
|
9 except OSError as o: |
f493979f1408
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff
changeset
|
10 # We don't need to crash the program |
f493979f1408
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff
changeset
|
11 print 'Warning: ' + str(o) |
f493979f1408
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff
changeset
|
12 |
f493979f1408
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff
changeset
|
13 # Remove 'myHub' folder and its content |
f493979f1408
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff
changeset
|
14 shutil.rmtree('myHub', ignore_errors=True) |