mirror of
http://aero2k.de/t/repos/urlbot-native.git
synced 2017-09-06 15:25:38 +02:00
moved VERSION stuff to common.py
This commit is contained in:
15
common.py
15
common.py
@@ -42,3 +42,18 @@ def logger(severity, message):
|
|||||||
# if severity in sev:
|
# if severity in sev:
|
||||||
args = (sys.argv[0], time.strftime('%Y-%m-%d.%H:%M:%S'), severity, message)
|
args = (sys.argv[0], time.strftime('%Y-%m-%d.%H:%M:%S'), severity, message)
|
||||||
sys.stderr.write(e('%s %s %s: %s' % args) + '\n')
|
sys.stderr.write(e('%s %s %s: %s' % args) + '\n')
|
||||||
|
|
||||||
|
def get_version_git():
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
cmd = ['git', 'log', '-n', '1', '--oneline', '--abbrev-commit']
|
||||||
|
|
||||||
|
p = subprocess.Popen(cmd, bufsize=1, stdout=subprocess.PIPE)
|
||||||
|
first_line = p.stdout.readline()
|
||||||
|
|
||||||
|
if 0 == p.wait():
|
||||||
|
return "version (Git) '%s'" % e(first_line.strip())
|
||||||
|
else:
|
||||||
|
return "(unknown version)"
|
||||||
|
|
||||||
|
VERSION = get_version_git()
|
||||||
|
|||||||
@@ -18,9 +18,6 @@ config['hist_max_time'] = 10 * 60
|
|||||||
config['uptime'] = -time.time()
|
config['uptime'] = -time.time()
|
||||||
config['request_counter'] = 0
|
config['request_counter'] = 0
|
||||||
|
|
||||||
config['version'] = None
|
|
||||||
|
|
||||||
|
|
||||||
# the "dice" feature will use more efficient random data (0) for given users
|
# the "dice" feature will use more efficient random data (0) for given users
|
||||||
config['enhanced-random-user'] = ( 'FIXME', 'FIXME' )
|
config['enhanced-random-user'] = ( 'FIXME', 'FIXME' )
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ def command_version(args):
|
|||||||
|
|
||||||
if 'version' in args['data']:
|
if 'version' in args['data']:
|
||||||
return {
|
return {
|
||||||
'msg': args['reply_user'] + (''': I'm running ''' + conf('version'))
|
'msg': args['reply_user'] + (''': I'm running ''' + VERSION)
|
||||||
}
|
}
|
||||||
|
|
||||||
def command_unicode(args):
|
def command_unicode(args):
|
||||||
|
|||||||
16
urlbot.py
16
urlbot.py
@@ -187,19 +187,6 @@ def parse_delete(filepath):
|
|||||||
plugins.data_parse_other(content)
|
plugins.data_parse_other(content)
|
||||||
return
|
return
|
||||||
|
|
||||||
def get_version_git():
|
|
||||||
import subprocess
|
|
||||||
|
|
||||||
cmd = ['git', 'log', '-n', '1', '--oneline', '--abbrev-commit']
|
|
||||||
|
|
||||||
p = subprocess.Popen(cmd, bufsize=1, stdout=subprocess.PIPE)
|
|
||||||
first_line = p.stdout.readline()
|
|
||||||
|
|
||||||
if 0 == p.wait():
|
|
||||||
return "version (Git) '%s'" % e(first_line.strip())
|
|
||||||
else:
|
|
||||||
return "(unknown version)"
|
|
||||||
|
|
||||||
import plugins
|
import plugins
|
||||||
|
|
||||||
plugins.chat_write = chat_write
|
plugins.chat_write = chat_write
|
||||||
@@ -209,8 +196,7 @@ plugins.ratelimit_touch = ratelimit_touch
|
|||||||
plugins.register_all()
|
plugins.register_all()
|
||||||
|
|
||||||
if '__main__' == __name__:
|
if '__main__' == __name__:
|
||||||
set_conf('version', get_version_git())
|
print sys.argv[0] + ' ' + VERSION
|
||||||
print sys.argv[0] + ' ' + conf('version')
|
|
||||||
|
|
||||||
if not os.path.exists(fifo_path):
|
if not os.path.exists(fifo_path):
|
||||||
logger('error', 'fifo_path "%s" does not exist, exiting' % fifo_path)
|
logger('error', 'fifo_path "%s" does not exist, exiting' % fifo_path)
|
||||||
|
|||||||
Reference in New Issue
Block a user