mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 03:02:52 +01:00
setup.py: Use UTC for version number. Closes GH-717.
This commit is contained in:
parent
e6db4edb44
commit
7d716aa8f3
@ -745,7 +745,7 @@ class Filter(callbacks.Plugin):
|
|||||||
elif ord(c) >= 32:
|
elif ord(c) >= 32:
|
||||||
turned.append(c)
|
turned.append(c)
|
||||||
tlen += 1
|
tlen += 1
|
||||||
s = '%s \x02 \x02' % ''.join(reversed(turned))
|
s = u'%s \x02 \x02' % u''.join(reversed(turned))
|
||||||
irc.reply(s)
|
irc.reply(s)
|
||||||
uniud = wrap(uniud, ['text'])
|
uniud = wrap(uniud, ['text'])
|
||||||
Filter = internationalizeDocstring(Filter)
|
Filter = internationalizeDocstring(Filter)
|
||||||
|
21
setup.py
21
setup.py
@ -32,6 +32,8 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import time
|
||||||
|
import datetime
|
||||||
import tempfile
|
import tempfile
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
@ -47,13 +49,20 @@ version = None
|
|||||||
try:
|
try:
|
||||||
proc = subprocess.Popen('git show HEAD --format=%ci', shell=True,
|
proc = subprocess.Popen('git show HEAD --format=%ci', shell=True,
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
version = proc.stdout.readline()
|
date = proc.stdout.readline()
|
||||||
if sys.version_info[0] >= 3:
|
if sys.version_info[0] >= 3:
|
||||||
version = version.decode()
|
date = date.decode()
|
||||||
version = version \
|
date = time.strptime(date.strip(), '%Y-%m-%d %H:%M:%S %z')
|
||||||
.strip() \
|
utc_date = time.gmtime(time.mktime(date))
|
||||||
.split(' ')[0] \
|
version = time.strftime('%Y.%m.%d', utc_date)
|
||||||
.replace('-', '.')
|
else:
|
||||||
|
(date, timezone) = date.strip().rsplit(' ', 1)
|
||||||
|
date = datetime.datetime.strptime(date.strip(), '%Y-%m-%d %H:%M:%S')
|
||||||
|
offset = time.strptime(timezone[1:], '%H%M')
|
||||||
|
offset = datetime.timedelta(hours=offset.tm_hour,
|
||||||
|
minutes=offset.tm_min)
|
||||||
|
utc_date = date - offset
|
||||||
|
version = utc_date.strftime('%Y.%m.%d')
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
if not version:
|
if not version:
|
||||||
|
Loading…
Reference in New Issue
Block a user