[Python-modules-commits] [python-django] 01/01: Unapply patches and disable git-dpm

Raphaël Hertzog hertzog at moszumanska.debian.org
Sat May 20 14:02:51 UTC 2017


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

hertzog pushed a commit to branch debian/experimental
in repository python-django.

commit 9bf3bdc72863f9795c7920a1e6706a026cbee229
Author: Raphaël Hertzog <hertzog at debian.org>
Date:   Sat May 20 15:49:25 2017 +0200

    Unapply patches and disable git-dpm
---
 debian/.git-dpm                                    |  11 ---
 .../fix-25761-add-traceback-attribute.patch        | 109 ---------------------
 debian/patches/series                              |   1 -
 django/contrib/gis/geoip/base.py                   |  19 ++--
 django/utils/timezone.py                           |  73 +-------------
 docs/conf.py                                       |   5 +-
 6 files changed, 11 insertions(+), 207 deletions(-)

diff --git a/debian/.git-dpm b/debian/.git-dpm
deleted file mode 100644
index 17754f5..0000000
--- a/debian/.git-dpm
+++ /dev/null
@@ -1,11 +0,0 @@
-# see git-dpm(1) from git-dpm package
-4d38952987d36d8bf5179ffec58df898f05b0ca4
-4d38952987d36d8bf5179ffec58df898f05b0ca4
-c557dbb46d8948ae35bb6d43fa8a90a5fbc4ccc9
-c557dbb46d8948ae35bb6d43fa8a90a5fbc4ccc9
-python-django_1.11.1.orig.tar.gz
-c12f28ce78926b70241102391d86a92cf07110f1
-7857868
-debianTag="debian/%e%v"
-patchedTag="debian/patches/%e%v"
-upstreamTag="upstream/%e%u"
diff --git a/debian/patches/fix-25761-add-traceback-attribute.patch b/debian/patches/fix-25761-add-traceback-attribute.patch
deleted file mode 100644
index c9ab605..0000000
--- a/debian/patches/fix-25761-add-traceback-attribute.patch
+++ /dev/null
@@ -1,109 +0,0 @@
-From 4d38952987d36d8bf5179ffec58df898f05b0ca4 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rapha=C3=ABl=20Hertzog?= <hertzog at debian.org>
-Date: Wed, 25 Nov 2015 12:54:52 +0100
-Subject: Fix #25761 -- re-raised exceptions need __cause__.__traceback__
-
-When Django re-raises an exception, it sets the __cause__ attribute even
-in Python 2, thus mimicking Python's 3 behaviour for "raise Foo from Bar".
-However Python 3 also ensures that all exceptions have a __traceback__
-attribute and thus the "traceback2" Python 2 module (backport of Python
-3's "traceback" module) relies on the fact that whenever you have a
-__cause__ attribute, the recorded exception also has a __traceback__
-attribute.
-
-This is breaking at least testtools which is using traceback2 (see
-https://github.com/testing-cabal/testtools/issues/162).
-
-This commit fixes this inconsistency by ensuring that Django sets
-the __traceback__ attribute on any exception stored in a __cause__
-attribute of a re-raised exception.
-
-Patch-Name: fix-25761-add-traceback-attribute.patch
----
- django/utils/timezone.py | 73 +++++++++++++++++++++++++++++++++++++++++++++++-
- 1 file changed, 72 insertions(+), 1 deletion(-)
-
-diff --git a/django/utils/timezone.py b/django/utils/timezone.py
-index 090750793..ff44d2ffa 100644
---- a/django/utils/timezone.py
-+++ b/django/utils/timezone.py
-@@ -51,7 +51,78 @@ class FixedOffset(tzinfo):
-         return ZERO
- 
- 
--utc = pytz.utc
-+class ReferenceLocalTimezone(tzinfo):
-+    """
-+    Local time. Taken from Python's docs.
-+
-+    Used only when pytz isn't available, and most likely inaccurate. If you're
-+    having trouble with this class, don't waste your time, just install pytz.
-+
-+    Kept as close as possible to the reference version. __init__ was added to
-+    delay the computation of STDOFFSET, DSTOFFSET and DSTDIFF which is
-+    performed at import time in the example.
-+
-+    Subclasses contain further improvements.
-+    """
-+
-+    def __init__(self):
-+        self.STDOFFSET = timedelta(seconds=-_time.timezone)
-+        if _time.daylight:
-+            self.DSTOFFSET = timedelta(seconds=-_time.altzone)
-+        else:
-+            self.DSTOFFSET = self.STDOFFSET
-+        self.DSTDIFF = self.DSTOFFSET - self.STDOFFSET
-+        tzinfo.__init__(self)
-+
-+    def utcoffset(self, dt):
-+        if self._isdst(dt):
-+            return self.DSTOFFSET
-+        else:
-+            return self.STDOFFSET
-+
-+    def dst(self, dt):
-+        if self._isdst(dt):
-+            return self.DSTDIFF
-+        else:
-+            return ZERO
-+
-+    def tzname(self, dt):
-+        return _time.tzname[self._isdst(dt)]
-+
-+    def _isdst(self, dt):
-+        tt = (dt.year, dt.month, dt.day,
-+              dt.hour, dt.minute, dt.second,
-+              dt.weekday(), 0, 0)
-+        stamp = _time.mktime(tt)
-+        tt = _time.localtime(stamp)
-+        return tt.tm_isdst > 0
-+
-+
-+class LocalTimezone(ReferenceLocalTimezone):
-+    """
-+    Slightly improved local time implementation focusing on correctness.
-+
-+    It still crashes on dates before 1970 or after 2038, but at least the
-+    error message is helpful.
-+    """
-+
-+    def tzname(self, dt):
-+        is_dst = False if dt is None else self._isdst(dt)
-+        return _time.tzname[is_dst]
-+
-+    def _isdst(self, dt):
-+        try:
-+            return super(LocalTimezone, self)._isdst(dt)
-+        except (OverflowError, ValueError) as exc:
-+            exc_type = type(exc)
-+            exc_value = exc_type(
-+                "Unsupported value: %r. You should install pytz." % dt)
-+            exc_value.__cause__ = exc
-+            if not hasattr(exc, '__traceback__'):
-+                exc.__traceback__ = sys.exc_info()[2]
-+            six.reraise(exc_type, exc_value, sys.exc_info()[2])
-+
-+utc = pytz.utc if pytz else UTC()
- """UTC time zone as a tzinfo instance."""
- 
- 
diff --git a/debian/patches/series b/debian/patches/series
index 4549594..9b1ddfc 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,2 @@
 02_disable-sources-in-sphinxdoc.diff
 06_use_debian_geoip_database_as_default.diff
-fix-25761-add-traceback-attribute.patch
diff --git a/django/contrib/gis/geoip/base.py b/django/contrib/gis/geoip/base.py
index 1e33033..d40ae7e 100644
--- a/django/contrib/gis/geoip/base.py
+++ b/django/contrib/gis/geoip/base.py
@@ -68,8 +68,7 @@ class GeoIP(object):
         * path: Base directory to where GeoIP data is located or the full path
             to where the city or country data files (*.dat) are located.
             Assumes that both the city and country data sets are located in
-            this directory. Overrides the GEOIP_PATH settings attribute.
-            If neither is set, defaults to '/usr/share/GeoIP'.
+            this directory; overrides the GEOIP_PATH settings attribute.
 
         * cache: The cache settings when opening up the GeoIP datasets,
             and may be an integer in (0, 1, 2, 4, 8) corresponding to
@@ -78,13 +77,11 @@ class GeoIP(object):
             settings,  respectively.  Defaults to 0, meaning that the data is read
             from the disk.
 
-        * country: The name of the GeoIP country data file. Overrides
-            the GEOIP_COUNTRY settings attribute. If neither is set,
-            defaults to 'GeoIP.dat'
+        * country: The name of the GeoIP country data file.  Defaults to
+            'GeoIP.dat'; overrides the GEOIP_COUNTRY settings attribute.
 
-        * city: The name of the GeoIP city data file. Overrides the
-            GEOIP_CITY settings attribute. If neither is set, defaults
-            to 'GeoIPCity.dat'.
+        * city: The name of the GeoIP city data file.  Defaults to
+            'GeoLiteCity.dat'; overrides the GEOIP_CITY settings attribute.
         """
 
         warnings.warn(
@@ -101,7 +98,9 @@ class GeoIP(object):
 
         # Getting the GeoIP data path.
         if not path:
-            path = GEOIP_SETTINGS.get('GEOIP_PATH', '/usr/share/GeoIP')
+            path = GEOIP_SETTINGS.get('GEOIP_PATH')
+            if not path:
+                raise GeoIPException('GeoIP path must be provided via parameter or the GEOIP_PATH setting.')
         if not isinstance(path, six.string_types):
             raise TypeError('Invalid path type: %s' % type(path).__name__)
 
@@ -114,7 +113,7 @@ class GeoIP(object):
                 self._country = GeoIP_open(force_bytes(country_db), cache)
                 self._country_file = country_db
 
-            city_db = os.path.join(path, city or GEOIP_SETTINGS.get('GEOIP_CITY', 'GeoIPCity.dat'))
+            city_db = os.path.join(path, city or GEOIP_SETTINGS.get('GEOIP_CITY', 'GeoLiteCity.dat'))
             if os.path.isfile(city_db):
                 self._city = GeoIP_open(force_bytes(city_db), cache)
                 self._city_file = city_db
diff --git a/django/utils/timezone.py b/django/utils/timezone.py
index ff44d2f..0907507 100644
--- a/django/utils/timezone.py
+++ b/django/utils/timezone.py
@@ -51,78 +51,7 @@ class FixedOffset(tzinfo):
         return ZERO
 
 
-class ReferenceLocalTimezone(tzinfo):
-    """
-    Local time. Taken from Python's docs.
-
-    Used only when pytz isn't available, and most likely inaccurate. If you're
-    having trouble with this class, don't waste your time, just install pytz.
-
-    Kept as close as possible to the reference version. __init__ was added to
-    delay the computation of STDOFFSET, DSTOFFSET and DSTDIFF which is
-    performed at import time in the example.
-
-    Subclasses contain further improvements.
-    """
-
-    def __init__(self):
-        self.STDOFFSET = timedelta(seconds=-_time.timezone)
-        if _time.daylight:
-            self.DSTOFFSET = timedelta(seconds=-_time.altzone)
-        else:
-            self.DSTOFFSET = self.STDOFFSET
-        self.DSTDIFF = self.DSTOFFSET - self.STDOFFSET
-        tzinfo.__init__(self)
-
-    def utcoffset(self, dt):
-        if self._isdst(dt):
-            return self.DSTOFFSET
-        else:
-            return self.STDOFFSET
-
-    def dst(self, dt):
-        if self._isdst(dt):
-            return self.DSTDIFF
-        else:
-            return ZERO
-
-    def tzname(self, dt):
-        return _time.tzname[self._isdst(dt)]
-
-    def _isdst(self, dt):
-        tt = (dt.year, dt.month, dt.day,
-              dt.hour, dt.minute, dt.second,
-              dt.weekday(), 0, 0)
-        stamp = _time.mktime(tt)
-        tt = _time.localtime(stamp)
-        return tt.tm_isdst > 0
-
-
-class LocalTimezone(ReferenceLocalTimezone):
-    """
-    Slightly improved local time implementation focusing on correctness.
-
-    It still crashes on dates before 1970 or after 2038, but at least the
-    error message is helpful.
-    """
-
-    def tzname(self, dt):
-        is_dst = False if dt is None else self._isdst(dt)
-        return _time.tzname[is_dst]
-
-    def _isdst(self, dt):
-        try:
-            return super(LocalTimezone, self)._isdst(dt)
-        except (OverflowError, ValueError) as exc:
-            exc_type = type(exc)
-            exc_value = exc_type(
-                "Unsupported value: %r. You should install pytz." % dt)
-            exc_value.__cause__ = exc
-            if not hasattr(exc, '__traceback__'):
-                exc.__traceback__ = sys.exc_info()[2]
-            six.reraise(exc_type, exc_value, sys.exc_info()[2])
-
-utc = pytz.utc if pytz else UTC()
+utc = pytz.utc
 """UTC time zone as a tzinfo instance."""
 
 
diff --git a/docs/conf.py b/docs/conf.py
index a129d28..f1e1457 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -212,10 +212,7 @@ html_additional_pages = {}
 # html_split_index = False
 
 # If true, links to the reST sources are added to the pages.
-html_show_sourcelink = False
-
-# Do not ship a copy of the sources
-html_copy_source = False
+# html_show_sourcelink = True
 
 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
 # html_show_sphinx = True

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



More information about the Python-modules-commits mailing list