dont fail if old module does not exist

This commit is contained in:
j 2015-03-14 17:44:08 +05:30
parent fe6f81505b
commit d933ca8f63
1 changed files with 5 additions and 2 deletions

View File

@ -114,9 +114,12 @@ def install():
tar.extractall() tar.extractall()
tar.close() tar.close()
os.chdir(os.path.dirname(settings.base_dir)) os.chdir(os.path.dirname(settings.base_dir))
shutil.move(module, '%s_old' % module) module_old = '%s_old' % module
if os.path.exists(module):
shutil.move(module, module_old)
shutil.move(os.path.join(new, module), module) shutil.move(os.path.join(new, module), module)
shutil.rmtree('%s_old' % module) if os.path.exists(module_old):
shutil.rmtree(module_old)
shutil.rmtree(new) shutil.rmtree(new)
else: else:
os.unlink(module_tar) os.unlink(module_tar)