[Git][debian-gis-team/mapproxy][upstream] New upstream version 2.0.2+dfsg

Bas Couwenberg (@sebastic) gitlab at salsa.debian.org
Wed Jan 10 16:45:21 GMT 2024



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


Commits:
b317f49e by Bas Couwenberg at 2024-01-10T17:34:30+01:00
New upstream version 2.0.2+dfsg
- - - - -


8 changed files:

- CHANGES.txt
- doc/conf.py
- mapproxy/cache/azureblob.py
- mapproxy/cache/file.py
- mapproxy/cache/path.py
- mapproxy/cache/s3.py
- mapproxy/test/system/test_mixed_mode_format.py
- setup.py


Changes:

=====================================
CHANGES.txt
=====================================
@@ -1,6 +1,13 @@
 Nightly
 ~~~~~~~~~~~~~~~~~
 
+2.0.2 2024-01-10
+~~~~~~~~~~~~~~~~
+
+Fixes:
+
+- Revert PR "Fix mixed image format for file, S3 and azureblob caches"
+
 2.0.1 2024-01-05
 ~~~~~~~~~~~~~~~~~
 Improvements:


=====================================
doc/conf.py
=====================================
@@ -51,7 +51,7 @@ copyright = u'Oliver Tonnhofer, Omniscale'
 # The short X.Y version.
 version = '2.0'
 # The full version, including alpha/beta/rc tags.
-release = '2.0.1'
+release = '2.0.2'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.


=====================================
mapproxy/cache/azureblob.py
=====================================
@@ -57,7 +57,6 @@ class AzureBlobCache(TileCacheBase):
 
         self.base_path = base_path
         self.file_ext = file_ext
-        self.is_mixed = self.file_ext == 'mixed'
         self._concurrent_writer = _concurrent_writer
         self._concurrent_reader = _concurrent_reader
         self._tile_location, _ = path.location_funcs(layout=directory_layout)
@@ -71,16 +70,7 @@ class AzureBlobCache(TileCacheBase):
         return self._container_client_cache.client
 
     def tile_key(self, tile):
-        if self.is_mixed:
-            location = self._tile_location(tile, self.base_path, 'jpeg').lstrip('/')
-            blob = self.container_client.get_blob_client(location)
-            if not blob.exists():
-                tile.location = None
-                location = self._tile_location(tile, self.base_path, 'png').lstrip('/')
-        else:
-            location = self._tile_location(tile, self.base_path, self.file_ext).lstrip('/')
-        tile.location = location
-        return location
+        return self._tile_location(tile, self.base_path, self.file_ext).lstrip('/')
 
     def load_tile_metadata(self, tile, dimensions=None):
         if tile.timestamp:


=====================================
mapproxy/cache/file.py
=====================================
@@ -42,7 +42,6 @@ class FileCache(TileCacheBase):
         self.cache_dir = cache_dir
         self.file_ext = file_ext
         self.image_opts = image_opts
-        self.is_mixed = self.file_ext == 'mixed'
         self.link_single_color_images = link_single_color_images
         self._tile_location, self._level_location = path.location_funcs(layout=directory_layout)
         if self._level_location is None:
@@ -54,16 +53,7 @@ class FileCache(TileCacheBase):
             items.sort()
             dimensions_str = ['{key}-{value}'.format(key=i, value=dimensions[i].replace('/', '_')) for i in items]
             cache_dir = os.path.join(self.cache_dir, '_'.join(dimensions_str))
-        
-        if self.is_mixed:
-            location = self._tile_location(tile, self.cache_dir, 'jpeg', create_dir=create_dir, dimensions=dimensions)
-            if not os.path.exists(location):
-                tile.location = None
-                location = self._tile_location(tile, self.cache_dir, 'png', create_dir=create_dir, dimensions=dimensions)
-        else:
-            location = self._tile_location(tile, self.cache_dir, self.file_ext, create_dir=create_dir, dimensions=dimensions)
-        tile.location = location
-        return location
+        return self._tile_location(tile, self.cache_dir, self.file_ext, create_dir=create_dir, dimensions=dimensions)
 
     def level_location(self, level, dimensions=None):
         """


=====================================
mapproxy/cache/path.py
=====================================
@@ -96,23 +96,22 @@ def tile_location_tc(tile, cache_dir, file_ext, create_dir=False, dimensions=Non
     >>> tile_location_tc(Tile((3, 4, 2)), '/tmp/cache', 'png').replace('\\\\', '/')
     '/tmp/cache/02/000/000/003/000/000/004.png'
     """
-    location = tile.location
-    if location is None:
+    if tile.location is None:
         x, y, z = tile.coord
         
         parts = (cache_dir,
                 dimensions_part(dimensions),
                 level_part(z),
-                    "%03d" % int(x / 1000000),
-                    "%03d" % (int(x / 1000) % 1000),
-                    "%03d" % (int(x) % 1000),
-                    "%03d" % int(y / 1000000),
-                    "%03d" % (int(y / 1000) % 1000),
-                    "%03d.%s" % (int(y) % 1000, file_ext))
-        location = os.path.join(*parts)
+                 "%03d" % int(x / 1000000),
+                 "%03d" % (int(x / 1000) % 1000),
+                 "%03d" % (int(x) % 1000),
+                 "%03d" % int(y / 1000000),
+                 "%03d" % (int(y / 1000) % 1000),
+                 "%03d.%s" % (int(y) % 1000, file_ext))
+        tile.location = os.path.join(*parts)
     if create_dir:
-        ensure_directory(location)
-    return location
+        ensure_directory(tile.location)
+    return tile.location
 
 def tile_location_mp(tile, cache_dir, file_ext, create_dir=False, dimensions=None):
     """
@@ -129,20 +128,19 @@ def tile_location_mp(tile, cache_dir, file_ext, create_dir=False, dimensions=Non
     >>> tile_location_mp(Tile((12345678, 98765432, 22)), '/tmp/cache', 'png').replace('\\\\', '/')
     '/tmp/cache/22/1234/5678/9876/5432.png'
     """
-    location = tile.location
-    if location is None:
+    if tile.location is None:
         x, y, z = tile.coord
         parts = (cache_dir,
                 dimensions_part(dimensions),
                 level_part(z),
-                    "%04d" % int(x / 10000),
-                    "%04d" % (int(x) % 10000),
-                    "%04d" % int(y / 10000),
-                    "%04d.%s" % (int(y) % 10000, file_ext))
-        location = os.path.join(*parts)
+                 "%04d" % int(x / 10000),
+                 "%04d" % (int(x) % 10000),
+                 "%04d" % int(y / 10000),
+                 "%04d.%s" % (int(y) % 10000, file_ext))
+        tile.location = os.path.join(*parts)
     if create_dir:
-        ensure_directory(location)
-    return location
+        ensure_directory(tile.location)
+    return tile.location
 
 def tile_location_tms(tile, cache_dir, file_ext, create_dir=False, dimensions=None):
     """
@@ -157,16 +155,15 @@ def tile_location_tms(tile, cache_dir, file_ext, create_dir=False, dimensions=No
     >>> tile_location_tms(Tile((3, 4, 2)), '/tmp/cache', 'png').replace('\\\\', '/')
     '/tmp/cache/2/3/4.png'
     """
-    location = tile.location
-    if location is None:
+    if tile.location is None:
         x, y, z = tile.coord
-        location = os.path.join(
+        tile.location = os.path.join(
             cache_dir,dimensions_part(dimensions) ,level_part(str(z)),
             str(x), str(y) + '.' + file_ext
         )
     if create_dir:
-        ensure_directory(location)
-    return location
+        ensure_directory(tile.location)
+    return tile.location
 
 def tile_location_reverse_tms(tile, cache_dir, file_ext, create_dir=False, dimensions=None):
     """
@@ -181,15 +178,14 @@ def tile_location_reverse_tms(tile, cache_dir, file_ext, create_dir=False, dimen
     >>> tile_location_reverse_tms(Tile((3, 4, 2)), '/tmp/cache', 'png').replace('\\\\', '/')
     '/tmp/cache/4/3/2.png'
     """
-    location = tile.location
-    if location is None:
+    if tile.location is None:
         x, y, z = tile.coord
-        location = os.path.join(
+        tile.location = os.path.join(
             cache_dir,dimensions_part(dimensions),str(y), str(x), str(z) + '.' + file_ext
         )
     if create_dir:
-        ensure_directory(location)
-    return location
+        ensure_directory(tile.location)
+    return tile.location
 
 def level_location_tms(level, cache_dir, dimensions=None):
     return level_location(str(level), cache_dir=cache_dir)
@@ -207,8 +203,7 @@ def tile_location_quadkey(tile, cache_dir, file_ext, create_dir=False, dimension
     >>> tile_location_quadkey(Tile((3, 4, 2)), '/tmp/cache', 'png').replace('\\\\', '/')
     '/tmp/cache/11.png'
     """
-    location = tile.location
-    if location is None:
+    if tile.location is None:
         x, y, z = tile.coord
         quadKey = ""
         for i in range(z,0,-1):
@@ -219,12 +214,12 @@ def tile_location_quadkey(tile, cache_dir, file_ext, create_dir=False, dimension
             if (y & mask) != 0:
                 digit += 2
             quadKey += str(digit)
-        location = os.path.join(
+        tile.location = os.path.join(
             cache_dir, quadKey + '.' + file_ext
         )
     if create_dir:
-        ensure_directory(location)
-    return location
+        ensure_directory(tile.location)
+    return tile.location
 
 def no_level_location(level, cache_dir, dimensions=None):
     # dummy for quadkey cache which stores all tiles in one directory
@@ -243,14 +238,13 @@ def tile_location_arcgiscache(tile, cache_dir, file_ext, create_dir=False, dimen
     >>> tile_location_arcgiscache(Tile((1234567, 87654321, 9)), '/tmp/cache', 'png').replace('\\\\', '/')
     '/tmp/cache/L09/R05397fb1/C0012d687.png'
     """
-    location = tile.location
-    if location is None:
+    if tile.location is None:
         x, y, z = tile.coord
         parts = (cache_dir, 'L%02d' % z, 'R%08x' % y, 'C%08x.%s' % (x, file_ext))
-        location = os.path.join(*parts)
+        tile.location = os.path.join(*parts)
     if create_dir:
-        ensure_directory(location)
-    return location
+        ensure_directory(tile.location)
+    return tile.location
 
 def level_location_arcgiscache(z, cache_dir, dimensions=None):
     return level_location('L%02d' % z, cache_dir=cache_dir, dimensions=dimensions)


=====================================
mapproxy/cache/s3.py
=====================================
@@ -79,7 +79,6 @@ class S3Cache(TileCacheBase):
 
         self.base_path = base_path
         self.file_ext = file_ext
-        self.is_mixed = self.file_ext == 'mixed'
         self._concurrent_writer = _concurrent_writer
 
         self._tile_location, _ = path.location_funcs(layout=directory_layout)
@@ -88,18 +87,7 @@ class S3Cache(TileCacheBase):
         return "https://{bucket}.s3.{region}.amazonaws.com/{key}".format(bucket=self.bucket_name, region=self.region_name, key=self.tile_key(tile))
 
     def tile_key(self, tile):
-        if self.is_mixed:
-            location = self._tile_location(tile, self.base_path, 'jpeg').lstrip('/')
-            try:
-                self.conn().head_object(Bucket=self.bucket_name, Key=location)
-            except botocore.exceptions.ClientError as e:
-                if e.response['Error']['Code'] in ('404', 'NoSuchKey'):
-                    tile.location = None
-                    location = self._tile_location(tile, self.base_path, 'png').lstrip('/')
-        else:
-            location = self._tile_location(tile, self.base_path, self.file_ext).lstrip('/')
-        tile.location = location
-        return location
+        return self._tile_location(tile, self.base_path, self.file_ext).lstrip('/')
 
     def conn(self):
         if boto3 is None:


=====================================
mapproxy/test/system/test_mixed_mode_format.py
=====================================
@@ -85,8 +85,8 @@ class TestWMS(SysTest):
 
         # check cache formats
         for f, format in [
-            [f"mixed_cache_EPSG900913/01/000/000/000/000/000/001.{req_format}", "png"],
-            [f"mixed_cache_EPSG900913/01/000/000/001/000/000/001.{req_format}", "jpeg"],
+            ["mixed_cache_EPSG900913/01/000/000/000/000/000/001.mixed", "png"],
+            ["mixed_cache_EPSG900913/01/000/000/001/000/000/001.mixed", "jpeg"],
         ]:
             assert cache_dir.join(f).check()
             check_format(cache_dir.join(f).read_binary(), format)
@@ -119,10 +119,10 @@ class TestTMS(SysTest):
 
                 assert resp.content_type == "image/jpeg"
         assert cache_dir.join(
-            "mixed_cache_EPSG900913/01/000/000/000/000/000/000.png"
+            "mixed_cache_EPSG900913/01/000/000/000/000/000/000.mixed"
         ).check()
         assert cache_dir.join(
-            "mixed_cache_EPSG900913/01/000/000/001/000/000/000.png"
+            "mixed_cache_EPSG900913/01/000/000/001/000/000/000.mixed"
         ).check()
 
 
@@ -169,10 +169,10 @@ class TestWMTS(SysTest):
                 resp = app.get(self.common_tile_req)
                 assert resp.content_type == "image/jpeg"
         assert cache_dir.join(
-            "mixed_cache_EPSG900913/01/000/000/000/000/000/001.png"
+            "mixed_cache_EPSG900913/01/000/000/000/000/000/001.mixed"
         ).check()
         assert cache_dir.join(
-            "mixed_cache_EPSG900913/01/000/000/001/000/000/001.png"
+            "mixed_cache_EPSG900913/01/000/000/001/000/000/001.mixed"
         ).check()
 
 


=====================================
setup.py
=====================================
@@ -54,7 +54,7 @@ def long_description(changelog_releases=10):
 
 setup(
     name='MapProxy',
-    version="2.0.1",
+    version="2.0.2",
     description='An accelerating proxy for tile and web map services',
     long_description=long_description(7),
     author='Oliver Tonnhofer',



View it on GitLab: https://salsa.debian.org/debian-gis-team/mapproxy/-/commit/b317f49e7663004c38cb7652e7f24203d3489652

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/mapproxy/-/commit/b317f49e7663004c38cb7652e7f24203d3489652
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/20240110/c9ecfcaf/attachment-0001.htm>


More information about the Pkg-grass-devel mailing list