[Git][debian-gis-team/rasterio][master] 4 commits: New upstream version 1.0.15

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


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


Commits:
d6b754d4 by Bas Couwenberg at 2019-01-28T06:20:03Z
New upstream version 1.0.15
- - - - -
ca3eb8e1 by Bas Couwenberg at 2019-01-28T06:20:08Z
Merge tag 'upstream/1.0.15'

Upstream version 1.0.15

- - - - -
ac3943d9 by Bas Couwenberg at 2019-01-28T06:20:28Z
New upstream release.

- - - - -
13c9e64d by Bas Couwenberg at 2019-01-28T06:21:29Z
Set distribution to unstable.

- - - - -


9 changed files:

- AUTHORS.txt
- CHANGES.txt
- debian/changelog
- 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)
 -------------------
 


=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+rasterio (1.0.15-1) unstable; urgency=medium
+
+  * Team upload.
+  * New upstream release.
+
+ -- Bas Couwenberg <sebastic at debian.org>  Mon, 28 Jan 2019 07:21:11 +0100
+
 rasterio (1.0.14-1) unstable; urgency=medium
 
   * Team upload.


=====================================
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/compare/f5b8b17fd4e0672dca0ba1953d510e9457db30a0...13c9e64d56f35b9d894d2bc240895be3aa59dafd

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/rasterio/compare/f5b8b17fd4e0672dca0ba1953d510e9457db30a0...13c9e64d56f35b9d894d2bc240895be3aa59dafd
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/f9d138c6/attachment-0001.html>


More information about the Pkg-grass-devel mailing list