PluginDownloader: Fix overwrite of existing plugin.

This commit is contained in:
Valentin Lorentz 2011-09-01 11:10:31 +02:00
parent dda08e0648
commit af65f64c1a

View File

@ -30,6 +30,7 @@
import os import os
import json import json
import shutil
import urllib import urllib
import urllib2 import urllib2
import tarfile import tarfile
@ -153,7 +154,7 @@ class GithubRepository(GitRepository):
newFileName = os.path.join(directory, newFileName) newFileName = os.path.join(directory, newFileName)
if os.path.exists(newFileName): if os.path.exists(newFileName):
assert os.path.isdir(newFileName) assert os.path.isdir(newFileName)
shutils.rmtree(newFileName) shutil.rmtree(newFileName)
if extractedFile is None: if extractedFile is None:
os.mkdir(newFileName) os.mkdir(newFileName)
else: else:
@ -260,6 +261,7 @@ class PluginDownloader(callbacks.Plugin):
repositories[repository].install(plugin) repositories[repository].install(plugin)
irc.replySuccess() irc.replySuccess()
except Exception as e: except Exception as e:
raise e
#FIXME: more detailed error message #FIXME: more detailed error message
log.error(str(e)) log.error(str(e))
irc.error('The plugin could not be installed.') irc.error('The plugin could not be installed.')