[Python-modules-commits] [python-tzlocal] 01/02: Revert "Merge branch 'upstream'"

Edward Betts edward at moszumanska.debian.org
Sat Nov 19 07:54:41 UTC 2016


This is an automated email from the git hooks/post-receive script.

edward pushed a commit to branch master
in repository python-tzlocal.

commit 3dc981f2cdfb47e8ba0e4aa2cfff4fc68e7ca7d8
Author: Edward Betts <edward at 4angle.com>
Date:   Sat Nov 19 07:52:52 2016 +0000

    Revert "Merge branch 'upstream'"
    
    This reverts commit cc2917e27f7100cd1e643e4473d3a5f6c42a54f4, reversing
    changes made to 49e5a4cf7a43b8ed3ba9b720c810e516dcd9425c.
---
 CHANGES.txt                                     |  6 -----
 PKG-INFO                                        |  8 +-----
 setup.py                                        |  2 +-
 tzlocal.egg-info/PKG-INFO                       |  8 +-----
 tzlocal.egg-info/SOURCES.txt                    |  1 -
 tzlocal/test_data/vardbzoneinfo/var/db/zoneinfo |  1 -
 tzlocal/tests.py                                |  6 -----
 tzlocal/unix.py                                 | 33 ++++++++++++-------------
 8 files changed, 19 insertions(+), 46 deletions(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index 317191f..051ccca 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,12 +1,6 @@
 Changes
 =======
 
-1.3 (2016-10-15)
-----------------
-
-- #34: Added support for /var/db/zoneinfo
-
-
 1.2.2 (2016-03-02)
 ------------------
 
diff --git a/PKG-INFO b/PKG-INFO
index a6a5ffe..8c9f14f 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: tzlocal
-Version: 1.3
+Version: 1.2.2
 Summary: tzinfo object for the local timezone
 Home-page: https://github.com/regebro/tzlocal
 Author: Lennart Regebro
@@ -95,12 +95,6 @@ Description: tzlocal
         Changes
         =======
         
-        1.3 (2016-10-15)
-        ----------------
-        
-        - #34: Added support for /var/db/zoneinfo
-        
-        
         1.2.2 (2016-03-02)
         ------------------
         
diff --git a/setup.py b/setup.py
index a155d4d..5189d6e 100644
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,7 @@
 from setuptools import setup, find_packages
 import sys, os
 
-version = '1.3'
+version = '1.2.2'
 
 setup(name='tzlocal',
       version=version,
diff --git a/tzlocal.egg-info/PKG-INFO b/tzlocal.egg-info/PKG-INFO
index a6a5ffe..8c9f14f 100644
--- a/tzlocal.egg-info/PKG-INFO
+++ b/tzlocal.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: tzlocal
-Version: 1.3
+Version: 1.2.2
 Summary: tzinfo object for the local timezone
 Home-page: https://github.com/regebro/tzlocal
 Author: Lennart Regebro
@@ -95,12 +95,6 @@ Description: tzlocal
         Changes
         =======
         
-        1.3 (2016-10-15)
-        ----------------
-        
-        - #34: Added support for /var/db/zoneinfo
-        
-        
         1.2.2 (2016-03-02)
         ------------------
         
diff --git a/tzlocal.egg-info/SOURCES.txt b/tzlocal.egg-info/SOURCES.txt
index 4735dcd..928b7e8 100644
--- a/tzlocal.egg-info/SOURCES.txt
+++ b/tzlocal.egg-info/SOURCES.txt
@@ -23,5 +23,4 @@ tzlocal/test_data/symlink_localtime/etc/localtime
 tzlocal/test_data/symlink_localtime/usr/share/zoneinfo/Africa/Harare
 tzlocal/test_data/timezone/etc/timezone
 tzlocal/test_data/timezone_setting/etc/conf.d/clock
-tzlocal/test_data/vardbzoneinfo/var/db/zoneinfo
 tzlocal/test_data/zone_setting/etc/sysconfig/clock
\ No newline at end of file
diff --git a/tzlocal/test_data/vardbzoneinfo/var/db/zoneinfo b/tzlocal/test_data/vardbzoneinfo/var/db/zoneinfo
deleted file mode 100644
index 28b3372..0000000
--- a/tzlocal/test_data/vardbzoneinfo/var/db/zoneinfo
+++ /dev/null
@@ -1 +0,0 @@
-Africa/Harare
diff --git a/tzlocal/tests.py b/tzlocal/tests.py
index e736eb4..6f70f14 100644
--- a/tzlocal/tests.py
+++ b/tzlocal/tests.py
@@ -54,12 +54,6 @@ class TzLocalTests(unittest.TestCase):
         tz = tzlocal.unix._get_localzone(_root=os.path.join(local_path, 'test_data', 'symlink_localtime'))
         self.assertEqual(tz.zone, 'Africa/Harare')
 
-    def test_vardbzoneinfo_setting(self):
-        # A ZONE setting in /etc/conf.d/clock, f ex Gentoo
-        local_path = os.path.split(__file__)[0]
-        tz = tzlocal.unix._get_localzone(_root=os.path.join(local_path, 'test_data', 'vardbzoneinfo'))
-        self.assertEqual(tz.zone, 'Africa/Harare')
-
     def test_only_localtime(self):
         local_path = os.path.split(__file__)[0]
         tz = tzlocal.unix._get_localzone(_root=os.path.join(local_path, 'test_data', 'localtime'))
diff --git a/tzlocal/unix.py b/tzlocal/unix.py
index 0d3f4e8..f1eff1e 100644
--- a/tzlocal/unix.py
+++ b/tzlocal/unix.py
@@ -44,22 +44,21 @@ def _get_localzone(_root='/'):
 
     # Now look for distribution specific configuration files
     # that contain the timezone name.
-    for configfile in ('etc/timezone', 'var/db/zoneinfo'):
-        tzpath = os.path.join(_root, configfile)
-        if os.path.exists(tzpath):
-            with open(tzpath, 'rb') as tzfile:
-                data = tzfile.read()
-
-                # Issue #3 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()
-                    # Get rid of host definitions and comments:
-                    if ' ' in etctz:
-                        etctz, dummy = etctz.split(' ', 1)
-                    if '#' in etctz:
-                        etctz, dummy = etctz.split('#', 1)
-                    return pytz.timezone(etctz.replace(' ', '_'))
+    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.
+            # That's a misconfiguration, but we need to handle it gracefully:
+            if data[:5] != 'TZif2':
+                etctz = data.strip().decode()
+                # Get rid of host definitions and comments:
+                if ' ' in etctz:
+                    etctz, dummy = etctz.split(' ', 1)
+                if '#' in etctz:
+                    etctz, dummy = etctz.split('#', 1)
+                return pytz.timezone(etctz.replace(' ', '_'))
 
     # CentOS has a ZONE setting in /etc/sysconfig/clock,
     # OpenSUSE has a TIMEZONE setting in /etc/sysconfig/clock and
@@ -91,7 +90,7 @@ def _get_localzone(_root='/'):
                 # We found a timezone
                 return pytz.timezone(etctz.replace(' ', '_'))
 
-    # 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)
     tzpath = os.path.join(_root, 'etc/localtime')
     if os.path.exists(tzpath) and os.path.islink(tzpath):

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-tzlocal.git



More information about the Python-modules-commits mailing list