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