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

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)