Merge branch 'testing' of github.com:ProgVal/Limnoria into testing

This commit is contained in:
Valentin Lorentz 2012-05-25 18:26:33 +02:00
commit d41d684ce1
5 changed files with 35 additions and 10 deletions

View File

@ -102,7 +102,10 @@ class Math(callbacks.Plugin):
return cmath.sqrt(x)
else:
return math.sqrt(x)
def _cbrt(x):
return math.pow(x, 1.0/3)
_mathEnv['sqrt'] = _sqrt
_mathEnv['cbrt'] = _cbrt
_mathEnv['abs'] = abs
_mathEnv['max'] = max
_mathEnv['min'] = min

View File

@ -302,7 +302,7 @@ class Misc(callbacks.Plugin):
version = ''.join(version.rsplit(':', 1))
# Replace the last '-' by '+':
version = '+'.join(version.rsplit('-', 1))
versions[branch] = version
versions[branch] = version.encode('utf-8')
newest = _('The newest versions available online are %s.') % \
', '.join([_('%s (in %s)') % (y,x)
for x,y in versions.items()])

View File

@ -172,9 +172,7 @@ class GithubRepository(GitRepository):
archive = self._download(plugin)
prefix = archive.getnames()[0]
dirname = ''.join((self._path, plugin))
print repr(prefix + dirname + '/README.txt')
for file in archive.getmembers():
print repr(file)
if file.name == prefix + dirname + '/README.txt':
extractedFile = archive.extractfile(file)
return extractedFile.read()
@ -263,6 +261,8 @@ class PluginDownloader(callbacks.Plugin):
which are available in that repository. When you want to install plugin,
just run command "install <repository> <plugin>"."""
threaded = True
@internationalizeDocstring
def repolist(self, irc, msg, args, repository):
"""[<repository>]

View File

@ -573,6 +573,24 @@ class Topic(callbacks.Plugin):
self._sendTopics(irc, channel, topics)
swap = wrap(swap, ['canChangeTopic', 'topicNumber', 'topicNumber'])
@internationalizeDocstring
def save(self, irc, msg, args, channel):
"""[<channel>]
Saves the topic in <channel> to be restored with @topic default
later. <channel> is only necessary if the message isn't sent in
the channel itself.
"""
if not self._checkManageCapabilities(irc, msg, channel):
capabilities = self.registryValue('requireManageCapability')
irc.errorNoCapability(capabilities, Raise=True)
topic = irc.state.getTopic(channel)
if topic:
self.setRegistryValue('default', value=topic, channel=channel)
else:
self.setRegistryValue('default', value='', channel=channel)
save = wrap(save, ['canChangeTopic'])
@internationalizeDocstring
def default(self, irc, msg, args, channel):
"""[<channel>]

View File

@ -52,6 +52,7 @@ import subprocess
plugins = [s for s in os.listdir('plugins') if
os.path.exists(os.path.join('plugins', s, 'plugin.py'))]
version = None
try:
proc = subprocess.Popen('git show HEAD --format=%ci', shell=True,
stdout=subprocess.PIPE)
@ -60,14 +61,17 @@ try:
.replace(' +', '+') \
.replace(' ', 'T')
except:
pass
if not version:
from time import gmtime, strftime
version = 'installed on ' + strftime("%Y-%m-%dT%H:%M:%S+0000", gmtime())
try:
os.unlink(os.path.join('src', 'version.py'))
except OSError: # Does not exist
pass
open(os.path.join('src', 'version.py'), 'a').write(
"version = '0.83.4.1+limnoria %s'\n" % version)
except:
raise
from src.version import version