[fiona] 01/05: Imported Upstream version 1.7.3

Johan Van de Wauw johanvdw-guest at moszumanska.debian.org
Tue Feb 14 19:29:09 UTC 2017


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

johanvdw-guest pushed a commit to branch master
in repository fiona.

commit b290253248e5f88508f9c8ba81a9543d4ca0246d
Author: Johan Van de Wauw <johan.vandewauw at gmail.com>
Date:   Tue Feb 14 20:04:20 2017 +0100

    Imported Upstream version 1.7.3
---
 CHANGES.txt           | 15 +++++++++++++++
 fiona/__init__.py     |  5 ++++-
 fiona/_drivers.pyx    |  9 +++++++--
 fiona/collection.py   |  6 +++---
 fiona/fio/cat.py      | 12 +++++++-----
 fiona/fio/info.py     |  4 ++--
 tests/test_fio_cat.py |  6 +++---
 tests/test_vfs.py     | 24 ++++++++++++++++++++++--
 8 files changed, 63 insertions(+), 18 deletions(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index c9bc5b6..e8304c5 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -3,6 +3,21 @@ Changes
 
 All issue numbers are relative to https://github.com/Toblerity/Fiona/issues.
 
+1.7.3 (2017-02-14)
+------------------
+
+Roses are red.
+Tan is a pug.
+Software regression's
+the most embarrassing bug.
+
+Bug fixes:
+
+- Use __stdcall for GDAL error handling callback on Windows as in Rasterio.
+- Turn on latent support for zip:// URLs in rio-cat and rio-info (#421).
+- The 1.7.2 release broke support for zip files with absolute paths (#418).
+  This regression has been fixed with tests to confirm.
+
 1.7.2 (2017-01-27)
 ------------------
 
diff --git a/fiona/__init__.py b/fiona/__init__.py
index a010654..88e7407 100644
--- a/fiona/__init__.py
+++ b/fiona/__init__.py
@@ -81,7 +81,7 @@ import uuid
 
 
 __all__ = ['bounds', 'listlayers', 'open', 'prop_type', 'prop_width']
-__version__ = "1.7.2"
+__version__ = "1.7.3"
 __gdal_version__ = get_gdal_release_name().decode('utf-8')
 
 log = logging.getLogger('Fiona')
@@ -239,6 +239,7 @@ def listlayers(path, vfs=None):
     with drivers():
         return _listlayers(vsi_path(path, vsi, archive))
 
+
 def parse_paths(path, vfs=None):
     archive = vsi = None
     if vfs:
@@ -251,6 +252,7 @@ def parse_paths(path, vfs=None):
         vsi = parts.pop() if parts else None
     return path, vsi, archive
 
+
 def prop_width(val):
     """Returns the width of a str type property.
 
@@ -265,6 +267,7 @@ def prop_width(val):
         return int((val.split(":")[1:] or ["80"])[0])
     return None
 
+
 def prop_type(text):
     """Returns a schema property's proper Python type.
 
diff --git a/fiona/_drivers.pyx b/fiona/_drivers.pyx
index 4f6df2e..7c49231 100644
--- a/fiona/_drivers.pyx
+++ b/fiona/_drivers.pyx
@@ -67,8 +67,13 @@ code_map = {
     10: 'CPLE_ObjectNull'
 }
 
-cdef void * errorHandler(int eErrClass, int err_no, char *msg):
-    log.log(level_map[eErrClass], "%s in %s", code_map[err_no], msg)
+
+IF UNAME_SYSNAME == "Windows":
+    cdef void * __stdcall errorHandler(int eErrClass, int err_no, char *msg):
+        log.log(level_map[eErrClass], "%s in %s", code_map[err_no], msg)
+ELSE:
+    cdef void * errorHandler(int eErrClass, int err_no, char *msg):
+        log.log(level_map[eErrClass], "%s in %s", code_map[err_no], msg)
 
 
 def driver_count():
diff --git a/fiona/collection.py b/fiona/collection.py
index 15be3e4..f249fd4 100644
--- a/fiona/collection.py
+++ b/fiona/collection.py
@@ -478,10 +478,10 @@ def vsi_path(path, vsi=None, archive=None):
     # an OGR VSI path (see cpl_vsi.h).
     if vsi:
         if archive:
-            result = '/'.join([
-                '/vsi{}'.format(vsi), archive.strip('/'), path.strip('/')])
+            result = '/vsi{0}/{1}{2}'.format(vsi, archive, path)
         else:
-            result = '/'.join(['/vsi{}'.format(vsi), path.strip('/')])
+            result = '/vsi{0}/{1}'.format(vsi, path)
     else:
         result = path
+
     return result
diff --git a/fiona/fio/cat.py b/fiona/fio/cat.py
index 8d8b85c..808a2a9 100644
--- a/fiona/fio/cat.py
+++ b/fiona/fio/cat.py
@@ -18,7 +18,8 @@ warnings.simplefilter('default')
 
 # Cat command
 @click.command(short_help="Concatenate and print the features of datasets")
- at cligj.files_in_arg
+ at click.argument('files', nargs=-1, type=click.Path(resolve_path=False),
+                required=True, metavar="INPUTS...")
 @click.option('--layer', default=None, multiple=True,
               callback=options.cb_multilayer,
               help="Input layer(s), specified as 'fileindex:layer` "
@@ -53,11 +54,12 @@ def cat(ctx, files, precision, indent, compact, ignore_errors, dst_crs,
         dump_kwds['indent'] = indent
     if compact:
         dump_kwds['separators'] = (',', ':')
-    item_sep = compact and ',' or ', '
+
     # Validate file idexes provided in --layer option
     # (can't pass the files to option callback)
     if layer:
         options.validate_multilayer_file_index(files, layer)
+
     # first layer is the default
     for i in range(1, len(files) + 1):
         if str(i) not in layer.keys():
@@ -75,9 +77,9 @@ def cat(ctx, files, precision, indent, compact, ignore_errors, dst_crs,
                         for i, feat in src.items(bbox=bbox):
                             if dst_crs or precision >= 0:
                                 g = transform_geom(
-                                        src.crs, dst_crs, feat['geometry'],
-                                        antimeridian_cutting=True,
-                                        precision=precision)
+                                    src.crs, dst_crs, feat['geometry'],
+                                    antimeridian_cutting=True,
+                                    precision=precision)
                                 feat['geometry'] = g
                                 feat['bbox'] = fiona.bounds(g)
                             if use_rs:
diff --git a/fiona/fio/info.py b/fiona/fio/info.py
index e77bc17..961774b 100644
--- a/fiona/fio/info.py
+++ b/fiona/fio/info.py
@@ -14,7 +14,7 @@ from fiona.fio import options
 
 @click.command()
 # One or more files.
- at click.argument('input', type=click.Path(exists=True))
+ at click.argument('input', type=click.Path(exists=False))
 @click.option('--layer', metavar="INDEX|NAME", callback=options.cb_layer,
               help="Print information about a specific layer.  The first "
                    "layer is used by default.  Layers use zero-based "
@@ -52,7 +52,7 @@ def info(ctx, input, indent, meta_member, layer):
                 info.update(bounds=src.bounds, name=src.name)
                 try:
                     info.update(count=len(src))
-                except TypeError as e:
+                except TypeError:
                     info.update(count=None)
                     logger.debug("Setting 'count' to None/null - layer does "
                                  "not support counting")
diff --git a/tests/test_fio_cat.py b/tests/test_fio_cat.py
index 04f6cdd..2d59c19 100644
--- a/tests/test_fio_cat.py
+++ b/tests/test_fio_cat.py
@@ -74,7 +74,7 @@ def test_multi_layer():
 
 def test_multi_layer_fail():
     runner = CliRunner()
-    result = runner.invoke(cat.cat, '--layer'
+    result = runner.invoke(cat.cat, ['--layer',
                            '200000:coutlildrnp',
-                           'tests/data')
-    assert result.exit_code == 1
+                           'tests/data'])
+    assert result.exit_code != 0
diff --git a/tests/test_vfs.py b/tests/test_vfs.py
index b5c2d61..754575b 100644
--- a/tests/test_vfs.py
+++ b/tests/test_vfs.py
@@ -26,11 +26,12 @@ class VsiReadingTest(ReadingTest):
         self.assertEqual(f['id'], "0")
         self.assertEqual(f['properties']['STATE'], 'UT')
 
+
 class ZipReadingTest(VsiReadingTest):
     
     def setUp(self):
         self.c = fiona.open("zip://tests/data/coutwildrnp.zip", "r")
-    
+
     def tearDown(self):
         self.c.close()
 
@@ -50,6 +51,7 @@ class ZipReadingTest(VsiReadingTest):
     def test_path(self):
         self.assertEqual(self.c.path, '/vsizip/tests/data/coutwildrnp.zip')
 
+
 class ZipArchiveReadingTest(VsiReadingTest):
     
     def setUp(self):
@@ -74,11 +76,29 @@ class ZipArchiveReadingTest(VsiReadingTest):
     def test_path(self):
         self.assertEqual(self.c.path, '/vsizip/tests/data/coutwildrnp.zip/coutwildrnp.shp')
 
+
+class ZipArchiveReadingTestAbsPath(ZipArchiveReadingTest):
+
+    def setUp(self):
+        self.c = fiona.open(
+                "/coutwildrnp.shp", "r",
+                vfs="zip://" + os.path.abspath("tests/data/coutwildrnp.zip"))
+
+    def test_open_repr(self):
+        self.assert_(repr(self.c).startswith("<open Collection '/vsizip//"))
+
+    def test_closed_repr(self):
+        self.c.close()
+        self.assert_(repr(self.c).startswith("<closed Collection '/vsizip//"))
+
+    def test_path(self):
+        self.assert_(self.c.path.startswith('/vsizip//'))
+
+
 class TarArchiveReadingTest(VsiReadingTest):
     
     def setUp(self):
         self.c = fiona.open("/testing/coutwildrnp.shp", "r", vfs="tar://tests/data/coutwildrnp.tar")
-    
     def tearDown(self):
         self.c.close()
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/fiona.git



More information about the Pkg-grass-devel mailing list