1
0
mirror of http://aero2k.de/t/repos/urlbot-native.git synced 2017-09-06 15:25:38 +02:00

"version" added; print_version_git()->get_version_git()

This commit is contained in:
urlbot
2014-08-20 03:12:06 +02:00
parent a70515ad6a
commit bbf5f3f77f

View File

@@ -199,7 +199,9 @@ def parse_commands(data):
return False return False
if 'command' in data: if 'command' in data:
chat_write(reply_user + (""": known commands: 'command', 'info', 'hangup', 'ping', 'uptime'""")) chat_write(reply_user + (""": known commands: 'command', 'info', 'hangup', 'ping', 'uptime', 'version'"""))
elif 'version' in data:
chat_write(reply_user + (''': I'm running ''' + VERSION))
elif 'unikot' in data: elif 'unikot' in data:
chat_write(reply_user + (u''': ┌────────┐''')) chat_write(reply_user + (u''': ┌────────┐'''))
chat_write(reply_user + (u''': │Unicode!│''')) chat_write(reply_user + (u''': │Unicode!│'''))
@@ -247,7 +249,7 @@ def parse_delete(filepath):
os.remove(filepath) # probably better crash here os.remove(filepath) # probably better crash here
def print_version_git(): def get_version_git():
import subprocess import subprocess
cmd = ['git', 'log', '-n', '1', '--oneline', '--abbrev-commit'] cmd = ['git', 'log', '-n', '1', '--oneline', '--abbrev-commit']
@@ -256,12 +258,14 @@ def print_version_git():
first_line = p.stdout.readline() first_line = p.stdout.readline()
if 0 == p.wait(): if 0 == p.wait():
print sys.argv[0] + " version (Git) '%s'" % e(first_line.strip()) return "version (Git) '%s'" % e(first_line.strip())
else: else:
print sys.argv[0] + " (unknown version)" return "(unknown version)"
if '__main__' == __name__: if '__main__' == __name__:
print_version_git() VERSION = get_version_git()
print sys.argv[0] + ' ' + VERSION
parser = HTMLParser.HTMLParser() parser = HTMLParser.HTMLParser()
while 1: while 1: