[Git][debian-gis-team/mapproxy][master] 4 commits: Add patches for compatibility with Python 3.8.

Bas Couwenberg gitlab at salsa.debian.org
Sun May 24 14:44:51 BST 2020



Bas Couwenberg pushed to branch master at Debian GIS Project / mapproxy


Commits:
be96aa6a by Bas Couwenberg at 2020-05-24T15:00:04+02:00
Add patches for compatibility with Python 3.8.

- - - - -
fc36bce9 by Bas Couwenberg at 2020-05-24T15:10:43+02:00
Add patch to fix PIL version check.

- - - - -
abf9f37c by Bas Couwenberg at 2020-05-24T15:24:09+02:00
Add lintian override for manpage-without-executable.

- - - - -
c655879a by Bas Couwenberg at 2020-05-24T15:24:09+02:00
Set distribution to unstable.

- - - - -


6 changed files:

- debian/changelog
- + debian/mapproxy.lintian-overrides
- + debian/patches/0001-Change-deprecated-imports-for-Python-3.8-compat-433.patch
- + debian/patches/0001-image-fix-version-check-future-PIL-versions.patch
- + debian/patches/python3.8.patch
- debian/patches/series


Changes:

=====================================
debian/changelog
=====================================
@@ -1,11 +1,14 @@
-mapproxy (1.12.0-2) UNRELEASED; urgency=medium
+mapproxy (1.12.0-2) unstable; urgency=medium
 
   * Update override for embedded-javascript-library.
   * Bump Standards-Version to 4.5.0, no changes.
   * Drop Name field from upstream metadata.
   * Bump debhelper compat to 10.
+  * Add patches for compatibility with Python 3.8.
+  * Add patch to fix PIL version check.
+  * Add lintian override for manpage-without-executable.
 
- -- Bas Couwenberg <sebastic at debian.org>  Mon, 09 Sep 2019 20:54:10 +0200
+ -- Bas Couwenberg <sebastic at debian.org>  Sun, 24 May 2020 15:00:06 +0200
 
 mapproxy (1.12.0-1) unstable; urgency=medium
 


=====================================
debian/mapproxy.lintian-overrides
=====================================
@@ -0,0 +1,3 @@
+# Manpage for subcommand
+manpage-without-executable usr/share/man/man1/mapproxy-util-autoconfig.1.gz
+


=====================================
debian/patches/0001-Change-deprecated-imports-for-Python-3.8-compat-433.patch
=====================================
@@ -0,0 +1,121 @@
+From a18f8b345c698bc6f4b58d0d3e91c670ceee8a01 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Hannes=20Gr=C3=A4uler?= <github at uberhax0r.de>
+Date: Wed, 27 Nov 2019 15:15:14 +0100
+Subject: Change deprecated imports for Python 3.8 compat (#433)
+
+---
+ mapproxy/compat/modules.py          |  6 +++++-
+ mapproxy/exception.py               |  4 ++--
+ mapproxy/request/base.py            | 12 +++---------
+ mapproxy/service/template_helper.py |  2 +-
+ mapproxy/test/http.py               |  6 +++---
+ 5 files changed, 14 insertions(+), 16 deletions(-)
+
+--- a/mapproxy/compat/modules.py
++++ b/mapproxy/compat/modules.py
+@@ -5,5 +5,9 @@ __all__ = ['urlparse']
+ 
+ if PY2:
+     import urlparse; urlparse
++    from cgi import parse_qsl, escape
++    from urllib import quote
+ else:
+-    from urllib import parse as urlparse
+\ No newline at end of file
++    from html import escape
++    from urllib import parse as urlparse
++    from urllib.parse import parse_qsl, quote
+--- a/mapproxy/exception.py
++++ b/mapproxy/exception.py
+@@ -16,8 +16,8 @@
+ """
+ Service exception handling (WMS exceptions, XML, in_image, etc.).
+ """
+-import cgi
+ from mapproxy.response import Response
++from mapproxy.compat.modules import escape
+ 
+ class RequestError(Exception):
+     """
+@@ -116,7 +116,7 @@ class XMLExceptionHandler(ExceptionHandl
+         """
+         status_code = self.status_codes.get(request_error.code, self.status_code)
+         # escape &<> in error message (e.g. URL params)
+-        msg = cgi.escape(request_error.msg)
++        msg = escape(request_error.msg)
+         result = self.template.substitute(exception=msg,
+                                           code=request_error.code)
+         return Response(result, mimetype=self.mimetype, content_type=self.content_type,
+--- a/mapproxy/request/base.py
++++ b/mapproxy/request/base.py
+@@ -16,15 +16,9 @@
+ """
+ Service requests (parsing, handling, etc).
+ """
+-import cgi
+-
++from mapproxy.compat import PY2, iteritems, text_type
++from mapproxy.compat.modules import parse_qsl, urlparse, quote
+ from mapproxy.util.py import cached_property
+-from mapproxy.compat import iteritems, PY2, text_type
+-
+-if PY2:
+-    from urllib import quote
+-else:
+-    from urllib.parse import quote
+ 
+ class NoCaseMultiDict(dict):
+     """
+@@ -178,7 +172,7 @@ def url_decode(qs, charset='utf-8', deco
+     Parse query string `qs` and return a `NoCaseMultiDict`.
+     """
+     tmp = []
+-    for key, value in cgi.parse_qsl(qs, include_empty):
++    for key, value in parse_qsl(qs, include_empty):
+         if PY2:
+             if decode_keys:
+                 key = key.decode(charset, errors)
+--- a/mapproxy/service/template_helper.py
++++ b/mapproxy/service/template_helper.py
+@@ -13,8 +13,8 @@
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ 
+-from cgi import escape
+ from mapproxy.template import bunch
++from mapproxy.compat.modules import escape
+ 
+ __all__ = ['escape', 'indent', 'bunch', 'wms100format', 'wms100info_format',
+     'wms111metadatatype']
+--- a/mapproxy/test/http.py
++++ b/mapproxy/test/http.py
+@@ -15,10 +15,10 @@
+ 
+ from __future__ import print_function
+ 
++
+ import re
+ import threading
+ import sys
+-import cgi
+ import socket
+ import errno
+ import time
+@@ -26,7 +26,7 @@ import base64
+ from contextlib import contextmanager
+ from mapproxy.util.py import reraise
+ from mapproxy.compat import iteritems, PY2
+-from mapproxy.compat.modules import urlparse
++from mapproxy.compat.modules import urlparse, parse_qsl
+ if PY2:
+     from cStringIO import StringIO
+ else:
+@@ -418,7 +418,7 @@ def query_to_dict(query):
+     d = {}
+     if '?' in query:
+         query = query.split('?', 1)[-1]
+-    for key, value in cgi.parse_qsl(query):
++    for key, value in parse_qsl(query):
+         d[key.lower()] = value
+     return d
+ 


=====================================
debian/patches/0001-image-fix-version-check-future-PIL-versions.patch
=====================================
@@ -0,0 +1,82 @@
+From bbda7f8d9a10c9995daaf2e45cf60b336ee88268 Mon Sep 17 00:00:00 2001
+From: Oliver Tonnhofer <olt at bogosoft.com>
+Date: Thu, 16 Apr 2020 11:40:32 +0200
+Subject: image: fix version check future PIL versions
+
+---
+ mapproxy/compat/image.py         | 11 ++++++-----
+ mapproxy/test/unit/test_image.py |  7 +++----
+ 2 files changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/mapproxy/compat/image.py b/mapproxy/compat/image.py
+index 5c567562..a9458c61 100644
+--- a/mapproxy/compat/image.py
++++ b/mapproxy/compat/image.py
+@@ -25,6 +25,7 @@ try:
+     # prevent pyflakes warnings
+     Image, ImageColor, ImageDraw, ImageFont, ImagePalette, ImageChops, ImageMath
+     ImageFileDirectory_v2, TiffTags
++    PIL_VERSION = getattr(PIL, '__version__') or getattr(PIL, 'PILLOW_VERSION')
+ except ImportError:
+     # allow MapProxy to start without PIL (for tilecache only).
+     # issue warning and raise ImportError on first use of
+@@ -42,17 +43,17 @@ except ImportError:
+     Image.Image = NoPIL
+     ImageColor = NoPIL()
+     ImageColor.getrgb = lambda x: x
++    PIL_VERSION = None
+ 
+ def has_alpha_composite_support():
+     return hasattr(Image, 'alpha_composite')
+ 
+ def transform_uses_center():
+-    # transformation behavior changed with Pillow 3.4
++    # transformation behavior changed with Pillow 3.4 to use pixel centers
+     # https://github.com/python-pillow/Pillow/commit/5232361718bae0f0ccda76bfd5b390ebf9179b18
+-    if hasattr(PIL, 'PILLOW_VERSION'):
+-        if not PIL.PILLOW_VERSION.startswith(('1.', '2.', '3.0', '3.1', '3.2', '3.3')):
+-            return True
+-    return False
++    if not PIL_VERSION or PIL_VERSION.startswith(('1.', '2.', '3.0', '3.1', '3.2', '3.3')):
++        return False
++    return True
+ 
+ def quantize_pil(img, colors=256, alpha=False, defaults=None):
+     if hasattr(Image, 'FASTOCTREE'):
+diff --git a/mapproxy/test/unit/test_image.py b/mapproxy/test/unit/test_image.py
+index 74c7fbf2..c339092f 100644
+--- a/mapproxy/test/unit/test_image.py
++++ b/mapproxy/test/unit/test_image.py
+@@ -19,10 +19,9 @@ import os
+ 
+ from io import BytesIO
+ 
+-import PIL
+ import pytest
+ 
+-from mapproxy.compat.image import Image, ImageDraw
++from mapproxy.compat.image import Image, ImageDraw, PIL_VERSION
+ from mapproxy.image import (
+     BlankImageSource,
+     GeoReference,
+@@ -113,7 +112,7 @@ class TestImageSource(object):
+         assert is_tiff(ir.as_buffer(TIFF_FORMAT))
+         assert is_tiff(ir.as_buffer())
+ 
+-    @pytest.mark.skipif(PIL.PILLOW_VERSION < '6.1.0', reason="Pillow 6.1.0 required GeoTIFF")
++    @pytest.mark.skipif(PIL_VERSION < '6.1.0', reason="Pillow 6.1.0 required GeoTIFF")
+     def test_tiff_compression(self):
+         def encoded_size(encoding_options):
+             ir = ImageSource(create_debug_img((100, 100)), PNG_FORMAT)
+@@ -586,7 +585,7 @@ def assert_geotiff_tags(img, expected_origin, expected_pixel_res, srs, projected
+     assert tags[TIFF_GEOKEYDIRECTORYTAG][3*4+3] == srs
+ 
+ 
+- at pytest.mark.skipif(PIL.PILLOW_VERSION < '6.1.0', reason="Pillow 6.1.0 required GeoTIFF")
++ at pytest.mark.skipif(PIL_VERSION < '6.1.0', reason="Pillow 6.1.0 required GeoTIFF")
+ @pytest.mark.parametrize("compression", ['jpeg', 'raw', 'tiff_lzw'])
+ class TestGeoTIFF(object):
+ 
+-- 
+2.20.1
+


=====================================
debian/patches/python3.8.patch
=====================================
@@ -0,0 +1,46 @@
+Description: Fix SyntaxWarning issues with Python 3.8.
+ SyntaxWarning: 'bool' object is not callable; perhaps you missed a comma?
+ SyntaxWarning: "is" with a literal. Did you mean "=="?
+Author: Bas Couwenberg <sebastic at debian.org>
+Forwarded: https://github.com/mapproxy/mapproxy/pull/461
+
+--- a/mapproxy/test/unit/test_conf_loader.py
++++ b/mapproxy/test/unit/test_conf_loader.py
+@@ -903,7 +903,7 @@ class TestImageOptions(object):
+         except ConfigurationError:
+             pass
+         else:
+-            raise False('expected ConfigurationError')
++            raise Exception('expected ConfigurationError')
+ 
+ 
+         conf_dict['globals']['image']['formats']['image/jpeg']['encoding_options'] = {
+@@ -914,7 +914,7 @@ class TestImageOptions(object):
+         except ConfigurationError:
+             pass
+         else:
+-            raise False('expected ConfigurationError')
++            raise Exception('expected ConfigurationError')
+ 
+ 
+         conf_dict['globals']['image']['formats']['image/jpeg']['encoding_options'] = {}
+@@ -924,7 +924,7 @@ class TestImageOptions(object):
+         except ConfigurationError:
+             pass
+         else:
+-            raise False('expected ConfigurationError')
++            raise Exception('expected ConfigurationError')
+ 
+ 
+         conf_dict['globals']['image']['formats']['image/jpeg']['encoding_options'] = {
+--- a/mapproxy/util/ext/wmsparse/parse.py
++++ b/mapproxy/util/ext/wmsparse/parse.py
+@@ -53,7 +53,7 @@ class WMSCapabilities(object):
+ 
+     def parse_contact(self):
+         elem = self.find(self.tree, 'Service/ContactInformation')
+-        if elem is None or len(elem) is 0:
++        if elem is None or len(elem) == 0:
+             elem = etree.Element(None)
+         md = dict(
+             person = self.findtext(elem, 'ContactPersonPrimary/ContactPerson'),


=====================================
debian/patches/series
=====================================
@@ -1 +1,4 @@
 disable-tag_date.patch
+0001-Change-deprecated-imports-for-Python-3.8-compat-433.patch
+python3.8.patch
+0001-image-fix-version-check-future-PIL-versions.patch



View it on GitLab: https://salsa.debian.org/debian-gis-team/mapproxy/-/compare/7e0cf1670617f944b68dc1f356cc47244ea956f9...c655879af97c6a2f6c666d77f0d72528670c462f

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/mapproxy/-/compare/7e0cf1670617f944b68dc1f356cc47244ea956f9...c655879af97c6a2f6c666d77f0d72528670c462f
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20200524/ef0c4b94/attachment-0001.html>


More information about the Pkg-grass-devel mailing list