Skip to content

Commit

Permalink
Added authors file
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuhiko committed Jul 24, 2013
1 parent 507dba5 commit 1f67eab
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 5 deletions.
23 changes: 23 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Babel is written and maintained by the Babel team and various contributors:

Maintainer and Current Project Lead:

- Armin Ronacher <armin.ronacher@active-4.com>

Contributors:

- Christopher Lenz <cmlenz@gmail.com>
- Alex Morega <alex@grep.ro>
- Felix Schwarz <felix.schwarz@oss.schwarz.eu>
- Pedro Algarvio <pedro@algarvio.me>
- Jeroen Ruigrok van der Werven <asmodai@in-nomine.org>
- Philip Jenvey <pjenvey@underboss.org>
- Tobias Bieniek <Tobias.Bieniek@gmx.de>
- Jonas Borgström <jonas@edgewall.org>
- Daniel Neuhäuser <dasdasich@gmail.com>
- Nick Retallack <nick@bitcasa.com>
- Thomas Waldmann <tw@waldmann-edv.de>

Babel was previously developed under the Copyright of Edgewall Software. The
following copyright notice holds true for releases before 2013: "Copyright (c)
2007 - 2011 by Edgewall Software"
2 changes: 0 additions & 2 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
Version 1.0
http://svn.edgewall.org/repos/babel/tags/1.0.0/
(? ? 2013 from trunk)

* support python 2.6, 2.7, 3.3+ and pypy - drop all other versions
* use tox for testing on different pythons
Expand Down
3 changes: 2 additions & 1 deletion COPYING → LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Copyright (C) 2007-2011 Edgewall Software
Copyright (C) 2013 by the Babel Team, see AUTHORS for more information.

All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
30 changes: 28 additions & 2 deletions babel/localtime/_unix.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
from __future__ import with_statement
import os
import re
import sys
import pytz
import subprocess

_systemconfig_tz = re.compile(r'^Time Zone: (.*)$(?m)')


def _tz_from_env(tzenv):
Expand Down Expand Up @@ -30,7 +34,8 @@ def _get_localzone(_root='/'):
name is unknown.
The parameter _root makes the function look for files like /etc/localtime
beneath the _root directory. This is primarily used by the tests.
In normal usage you call the function without parameters."""
In normal usage you call the function without parameters.
"""

tzenv = os.environ.get('TZ')
if tzenv:
Expand All @@ -52,14 +57,34 @@ def _get_localzone(_root='/'):
except pytz.UnknownTimeZoneError:
pass

# If we are on OS X now we are pretty sure that the rest of the
# code will fail and just fall through until it hits the reading
# of /etc/localtime and using it without name. At this point we
# can invoke systemconfig which internally invokes ICU. ICU itself
# does the same thing we do (readlink + compare file contents) but
# since it knows where the zone files are that should be a bit
# better than reimplementing the logic here.
if sys.platform == 'darwin':
c = subprocess.Popen(['systemsetup', '-gettimezone'],
stdout=subprocess.PIPE)
sys_result = c.communicate()[0]
c.wait()
tz_match = _systemconfig_tz.search(sys_result)
if tz_match is not None:
zone_name = tz_match.group(1)
try:
return pytz.timezone(zone_name)
except pytz.UnknownTimeZoneError:
pass

# Now look for distribution specific configuration files
# that contain the timezone name.
tzpath = os.path.join(_root, 'etc/timezone')
if os.path.exists(tzpath):
with open(tzpath, 'rb') as tzfile:
data = tzfile.read()

# Issue #3 was that /etc/timezone was a zoneinfo file.
# Issue #3 in tzlocal was that /etc/timezone was a zoneinfo file.
# That's a misconfiguration, but we need to handle it gracefully:
if data[:5] != 'TZif2':
etctz = data.strip().decode()
Expand Down Expand Up @@ -105,6 +130,7 @@ def _get_localzone(_root='/'):

if not os.path.exists(tzpath):
continue

with open(tzpath, 'rb') as tzfile:
return pytz.tzfile.build_tzinfo('local', tzfile)

Expand Down

0 comments on commit 1f67eab

Please sign in to comment.