Browse Source

Change add support for freebsd /var/db/zoneinfo when getting local timezone information.

pull/788/head
JackDandy 9 years ago
parent
commit
cd412e22e5
  1. 3
      .gitignore
  2. 1
      CHANGES.md
  3. 1
      HACKS.txt
  4. 7
      lib/tzlocal/unix.py

3
.gitignore

@ -13,9 +13,10 @@ restore/
###################### ######################
# SB Test Related # # SB Test Related #
tests/cache/*
tests/Logs/* tests/Logs/*
tests/sickbeard.* tests/sickbeard.*
tests/cache.db tests/*.db
###################### ######################
# Compiled source # # Compiled source #

1
CHANGES.md

@ -190,6 +190,7 @@
* Fix add custom torrent RSS * Fix add custom torrent RSS
* Remove ILT torrent provider * Remove ILT torrent provider
* Update Tornado Web Server 4.3.dev1 (1b6157d) to 4.4.dev1 (c2b4d05) * Update Tornado Web Server 4.3.dev1 (1b6157d) to 4.4.dev1 (c2b4d05)
* Change add support for freebsd /var/db/zoneinfo when getting local timezone information
### 0.11.15 (2016-09-13 19:50:00 UTC) ### 0.11.15 (2016-09-13 19:50:00 UTC)

1
HACKS.txt

@ -10,3 +10,4 @@ Libs with customisations...
/lib/requests/packages/urllib3/util/ssl_.py /lib/requests/packages/urllib3/util/ssl_.py
/lib/tornado /lib/tornado
/lib/tvdb/tvdb_api.py /lib/tvdb/tvdb_api.py
/lib/tzlocal/unix.py

7
lib/tzlocal/unix.py

@ -90,6 +90,13 @@ def _get_localzone(_root='/'):
# We found a timezone # We found a timezone
return pytz.timezone(etctz.replace(' ', '_')) return pytz.timezone(etctz.replace(' ', '_'))
# look for FreeBSD's /var/db/zoneinfo file, which contains the zone name and a newline.
freebsd_zoneinfo = os.path.join(_root, 'var/db/zoneinfo')
if os.path.exists(freebsd_zoneinfo):
with open(freebsd_zoneinfo, 'rt') as tzfile:
data = tzfile.read().strip()
return pytz.timezone(data)
# systemd distributions use symlinks that include the zone name, # systemd distributions use symlinks that include the zone name,
# see manpage of localtime(5) and timedatectl(1) # see manpage of localtime(5) and timedatectl(1)
tzpath = os.path.join(_root, 'etc/localtime') tzpath = os.path.join(_root, 'etc/localtime')

Loading…
Cancel
Save