Updated tzlocal module and removed check for improperly configured time zone.

pull/943/head^2
Louis Vézina 5 years ago
parent 59c9ed1fcf
commit c83d3eeae3

@ -18,8 +18,6 @@ from apscheduler.triggers.cron import CronTrigger
from apscheduler.triggers.date import DateTrigger from apscheduler.triggers.date import DateTrigger
from apscheduler.events import EVENT_JOB_SUBMITTED, EVENT_JOB_EXECUTED, EVENT_JOB_ERROR from apscheduler.events import EVENT_JOB_SUBMITTED, EVENT_JOB_EXECUTED, EVENT_JOB_ERROR
from datetime import datetime from datetime import datetime
import pytz
from tzlocal import get_localzone
from calendar import day_name from calendar import day_name
import pretty import pretty
from six import PY2 from six import PY2
@ -30,10 +28,7 @@ class Scheduler:
def __init__(self): def __init__(self):
self.__running_tasks = [] self.__running_tasks = []
if str(get_localzone()) == "local": self.aps_scheduler = BackgroundScheduler()
self.aps_scheduler = BackgroundScheduler(timezone=pytz.timezone('UTC'))
else:
self.aps_scheduler = BackgroundScheduler()
# task listener # task listener
def task_listener_add(event): def task_listener_add(event):

@ -84,11 +84,10 @@ def _get_localzone(_root='/'):
if not etctz: if not etctz:
continue continue
tz = pytz.timezone(etctz.replace(' ', '_')) tz = pytz.timezone(etctz.replace(' ', '_'))
# Disabling this offset valdation due to issue with some timezone: https://github.com/regebro/tzlocal/issues/80 if _root == '/':
# if _root == '/':
# We are using a file in etc to name the timezone. # We are using a file in etc to name the timezone.
# Verify that the timezone specified there is actually used: # Verify that the timezone specified there is actually used:
# utils.assert_tz_offset(tz) utils.assert_tz_offset(tz)
return tz return tz
except IOError: except IOError:

@ -1,5 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import time
import datetime import datetime
import calendar
def get_system_offset(): def get_system_offset():
@ -11,8 +13,14 @@ def get_system_offset():
To keep compatibility with Windows, we're always importing time module here. To keep compatibility with Windows, we're always importing time module here.
""" """
import time
if time.daylight and time.localtime().tm_isdst > 0: localtime = calendar.timegm(time.localtime())
gmtime = calendar.timegm(time.gmtime())
offset = gmtime - localtime
# We could get the localtime and gmtime on either side of a second switch
# so we check that the difference is less than one minute, because nobody
# has that small DST differences.
if abs(offset - time.altzone) < 60:
return -time.altzone return -time.altzone
else: else:
return -time.timezone return -time.timezone

@ -87,6 +87,7 @@ win_tz = {'AUS Central Standard Time': 'Australia/Darwin',
'Pacific Standard Time (Mexico)': 'America/Tijuana', 'Pacific Standard Time (Mexico)': 'America/Tijuana',
'Pakistan Standard Time': 'Asia/Karachi', 'Pakistan Standard Time': 'Asia/Karachi',
'Paraguay Standard Time': 'America/Asuncion', 'Paraguay Standard Time': 'America/Asuncion',
'Qyzylorda Standard Time': 'Asia/Qyzylorda',
'Romance Standard Time': 'Europe/Paris', 'Romance Standard Time': 'Europe/Paris',
'Russia Time Zone 10': 'Asia/Srednekolymsk', 'Russia Time Zone 10': 'Asia/Srednekolymsk',
'Russia Time Zone 11': 'Asia/Kamchatka', 'Russia Time Zone 11': 'Asia/Kamchatka',
@ -127,6 +128,7 @@ win_tz = {'AUS Central Standard Time': 'Australia/Darwin',
'Ulaanbaatar Standard Time': 'Asia/Ulaanbaatar', 'Ulaanbaatar Standard Time': 'Asia/Ulaanbaatar',
'Venezuela Standard Time': 'America/Caracas', 'Venezuela Standard Time': 'America/Caracas',
'Vladivostok Standard Time': 'Asia/Vladivostok', 'Vladivostok Standard Time': 'Asia/Vladivostok',
'Volgograd Standard Time': 'Europe/Volgograd',
'W. Australia Standard Time': 'Australia/Perth', 'W. Australia Standard Time': 'Australia/Perth',
'W. Central Africa Standard Time': 'Africa/Lagos', 'W. Central Africa Standard Time': 'Africa/Lagos',
'W. Europe Standard Time': 'Europe/Berlin', 'W. Europe Standard Time': 'Europe/Berlin',
@ -287,7 +289,7 @@ tz_win = {'Africa/Abidjan': 'Greenwich Standard Time',
'America/Mendoza': 'Argentina Standard Time', 'America/Mendoza': 'Argentina Standard Time',
'America/Menominee': 'Central Standard Time', 'America/Menominee': 'Central Standard Time',
'America/Merida': 'Central Standard Time (Mexico)', 'America/Merida': 'Central Standard Time (Mexico)',
'America/Metlakatla': 'Pacific Standard Time', 'America/Metlakatla': 'Alaskan Standard Time',
'America/Mexico_City': 'Central Standard Time (Mexico)', 'America/Mexico_City': 'Central Standard Time (Mexico)',
'America/Miquelon': 'Saint Pierre Standard Time', 'America/Miquelon': 'Saint Pierre Standard Time',
'America/Moncton': 'Atlantic Standard Time', 'America/Moncton': 'Atlantic Standard Time',
@ -347,13 +349,13 @@ tz_win = {'Africa/Abidjan': 'Greenwich Standard Time',
'America/Winnipeg': 'Central Standard Time', 'America/Winnipeg': 'Central Standard Time',
'America/Yakutat': 'Alaskan Standard Time', 'America/Yakutat': 'Alaskan Standard Time',
'America/Yellowknife': 'Mountain Standard Time', 'America/Yellowknife': 'Mountain Standard Time',
'Antarctica/Casey': 'W. Australia Standard Time', 'Antarctica/Casey': 'Singapore Standard Time',
'Antarctica/Davis': 'SE Asia Standard Time', 'Antarctica/Davis': 'SE Asia Standard Time',
'Antarctica/DumontDUrville': 'West Pacific Standard Time', 'Antarctica/DumontDUrville': 'West Pacific Standard Time',
'Antarctica/Macquarie': 'Central Pacific Standard Time', 'Antarctica/Macquarie': 'Central Pacific Standard Time',
'Antarctica/Mawson': 'West Asia Standard Time', 'Antarctica/Mawson': 'West Asia Standard Time',
'Antarctica/McMurdo': 'New Zealand Standard Time', 'Antarctica/McMurdo': 'New Zealand Standard Time',
'Antarctica/Palmer': 'Magallanes Standard Time', 'Antarctica/Palmer': 'SA Eastern Standard Time',
'Antarctica/Rothera': 'SA Eastern Standard Time', 'Antarctica/Rothera': 'SA Eastern Standard Time',
'Antarctica/South_Pole': 'New Zealand Standard Time', 'Antarctica/South_Pole': 'New Zealand Standard Time',
'Antarctica/Syowa': 'E. Africa Standard Time', 'Antarctica/Syowa': 'E. Africa Standard Time',
@ -424,7 +426,7 @@ tz_win = {'Africa/Abidjan': 'Greenwich Standard Time',
'Asia/Pyongyang': 'North Korea Standard Time', 'Asia/Pyongyang': 'North Korea Standard Time',
'Asia/Qatar': 'Arab Standard Time', 'Asia/Qatar': 'Arab Standard Time',
'Asia/Qostanay': 'Central Asia Standard Time', 'Asia/Qostanay': 'Central Asia Standard Time',
'Asia/Qyzylorda': 'West Asia Standard Time', 'Asia/Qyzylorda': 'Qyzylorda Standard Time',
'Asia/Rangoon': 'Myanmar Standard Time', 'Asia/Rangoon': 'Myanmar Standard Time',
'Asia/Riyadh': 'Arab Standard Time', 'Asia/Riyadh': 'Arab Standard Time',
'Asia/Saigon': 'SE Asia Standard Time', 'Asia/Saigon': 'SE Asia Standard Time',
@ -592,7 +594,7 @@ tz_win = {'Africa/Abidjan': 'Greenwich Standard Time',
'Europe/Vatican': 'W. Europe Standard Time', 'Europe/Vatican': 'W. Europe Standard Time',
'Europe/Vienna': 'W. Europe Standard Time', 'Europe/Vienna': 'W. Europe Standard Time',
'Europe/Vilnius': 'FLE Standard Time', 'Europe/Vilnius': 'FLE Standard Time',
'Europe/Volgograd': 'Russian Standard Time', 'Europe/Volgograd': 'Volgograd Standard Time',
'Europe/Warsaw': 'Central European Standard Time', 'Europe/Warsaw': 'Central European Standard Time',
'Europe/Zagreb': 'Central European Standard Time', 'Europe/Zagreb': 'Central European Standard Time',
'Europe/Zaporozhye': 'FLE Standard Time', 'Europe/Zaporozhye': 'FLE Standard Time',

@ -1,4 +1,4 @@
apprise=0.8.2 apprise=0.8.5
apscheduler=3.5.1 apscheduler=3.5.1
babelfish=0.5.5 babelfish=0.5.5
backports.functools-lru-cache=1.5 backports.functools-lru-cache=1.5
@ -13,7 +13,6 @@ gitpython=2.1.9
guessit=2.1.4 guessit=2.1.4
guess_language-spirit=0.5.3 guess_language-spirit=0.5.3
knowit=0.3.0-dev knowit=0.3.0-dev
peewee=3.9.6
py-pretty=1 py-pretty=1
pycountry=18.2.23 pycountry=18.2.23
pyga=2.6.1 pyga=2.6.1
@ -25,6 +24,6 @@ six=1.11.0
SimpleConfigParser=0.1.0 <-- modified version: do not update!!! SimpleConfigParser=0.1.0 <-- modified version: do not update!!!
stevedore=1.28.0 stevedore=1.28.0
subliminal=2.1.0dev subliminal=2.1.0dev
tzlocal=1.5.1 tzlocal=2.1b1
urllib3=1.23 urllib3=1.23
Js2Py=0.63 <-- modified: manually merged from upstream: https://github.com/PiotrDabkowski/Js2Py/pull/192/files Js2Py=0.63 <-- modified: manually merged from upstream: https://github.com/PiotrDabkowski/Js2Py/pull/192/files

Loading…
Cancel
Save