[Git][debian-gis-team/rasterio][upstream] New upstream version 1.0.15

Bas Couwenberg gitlab at salsa.debian.org
Mon Jan 28 06:39:32 GMT 2019


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


Commits:
d6b754d4 by Bas Couwenberg at 2019-01-28T06:20:03Z
New upstream version 1.0.15
- - - - -


8 changed files:

- AUTHORS.txt
- CHANGES.txt
- rasterio/__init__.py
- rasterio/_crs.pyx
- rasterio/path.py
- rasterio/rio/info.py
- rasterio/session.py
- tests/test_session.py


Changes:

=====================================
AUTHORS.txt
=====================================
@@ -68,4 +68,4 @@ Authors
 * Vincent Schut
 * Alan D.
 * grovduck
-* Dan Little
+* Dan "Ducky" Little


=====================================
CHANGES.txt
=====================================
@@ -1,6 +1,12 @@
 Changes
 =======
 
+1.0.15 (2019-01-27)
+-------------------
+
+- Google cloud storage support was *not* in fact added in 1.0.14, but is
+  present in 1.0.15.
+
 1.0.14 (2019-01-22)
 -------------------
 


=====================================
rasterio/__init__.py
=====================================
@@ -42,7 +42,7 @@ import rasterio.path
 
 
 __all__ = ['band', 'open', 'pad', 'Env']
-__version__ = "1.0.14"
+__version__ = "1.0.15"
 __gdal_version__ = gdal_version()
 
 # Rasterio attaches NullHandler to the 'rasterio' logger and its


=====================================
rasterio/_crs.pyx
=====================================
@@ -114,7 +114,10 @@ cdef class _CRS(object):
             exc_wrap_ogrerr(OSRMorphFromESRI(osr))
             if OSRAutoIdentifyEPSG(osr) == 0:
                 epsg_code = OSRGetAuthorityCode(osr, NULL)
-                return int(epsg_code.decode('utf-8'))
+                if epsg_code != NULL:
+                    return int(epsg_code.decode('utf-8'))
+                else:
+                    return None
             else:
                 return None
         finally:


=====================================
rasterio/path.py
=====================================
@@ -18,13 +18,14 @@ SCHEMES = {
     'tar': 'tar',
     'zip': 'zip',
     'file': 'file',
-    'oss': 'oss'
+    'oss': 'oss',
+    'gs': 'gs',
 }
 
 CURLSCHEMES = set([k for k, v in SCHEMES.items() if v == 'curl'])
 
 # TODO: extend for other cloud plaforms.
-REMOTESCHEMES = set([k for k, v in SCHEMES.items() if v in ('curl', 's3', 'oss')])
+REMOTESCHEMES = set([k for k, v in SCHEMES.items() if v in ('curl', 's3', 'oss', 'gs')])
 
 
 class Path(object):


=====================================
rasterio/rio/info.py
=====================================
@@ -92,8 +92,8 @@ def info(ctx, input, aspect, indent, namespace, meta_member, verbose, bidx,
 
         if gcps:
             info['gcps'] = {'points': [p.asdict() for p in gcps]}
-            if crs:
-                epsg = crs.to_epsg()
+            if gcps_crs:
+                epsg = gcps_crs.to_epsg()
                 if epsg:
                     info['gcps']['crs'] = 'EPSG:{}'.format(epsg)
                 else:


=====================================
rasterio/session.py
=====================================
@@ -316,6 +316,53 @@ class OSSSession(Session):
 
         """
         return {k.upper(): v for k, v in self.credentials.items()}
+    
+
+class GSSession(Session):
+    """Configures access to secured resources stored in Google Cloud Storage
+    """
+    def __init__(self, google_application_credentials=None):
+        """Create new Google Cloude Storage session
+
+        Parameters
+        ----------
+        google_application_credentials: string
+            Path to the google application credentials JSON file.
+        """
 
+        self._creds = {}
+        if google_application_credentials is not None:
+            self._creds['google_application_credentials'] = google_application_credentials
     
+    @classmethod
+    def hascreds(cls, config):
+        """Determine if the given configuration has proper credentials
 
+        Parameters
+        ----------
+        cls : class
+            A Session class.
+        config : dict
+            GDAL configuration as a dict.
+
+        Returns
+        -------
+        bool
+
+        """
+        return 'GOOGLE_APPLICATION_CREDENTIALS' in config
+
+    @property
+    def credentials(self):
+        """The session credentials as a dict"""
+        return self._creds
+
+    def get_credential_options(self):
+        """Get credentials as GDAL configuration options
+
+        Returns
+        -------
+        dict
+
+        """
+        return {k.upper(): v for k, v in self.credentials.items()}


=====================================
tests/test_session.py
=====================================
@@ -2,7 +2,7 @@
 
 import pytest
 
-from rasterio.session import DummySession, AWSSession, Session, OSSSession
+from rasterio.session import DummySession, AWSSession, Session, OSSSession, GSSession
 
 
 def test_dummy_session():
@@ -133,3 +133,10 @@ def test_session_factory_oss_kwargs():
     assert isinstance(sesh, OSSSession)
     assert sesh.get_credential_options()['OSS_ACCESS_KEY_ID'] == 'foo'
     assert sesh.get_credential_options()['OSS_SECRET_ACCESS_KEY'] == 'bar'
+
+def test_gs_session_class():
+    """GSSession works"""
+    gs_session = GSSession(
+        google_application_credentials='foo')
+    assert gs_session._creds
+    assert gs_session.get_credential_options()['GOOGLE_APPLICATION_CREDENTIALS'] == 'foo'



View it on GitLab: https://salsa.debian.org/debian-gis-team/rasterio/commit/d6b754d4c4e707fab84af03004f445590731f1f9

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/rasterio/commit/d6b754d4c4e707fab84af03004f445590731f1f9
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/20190128/c35e3ab1/attachment-0001.html>


More information about the Pkg-grass-devel mailing list