[Git][debian-gis-team/fiona][master] 4 commits: New upstream version 1.8.3
Bas Couwenberg
gitlab at salsa.debian.org
Sat Dec 1 08:34:23 GMT 2018
Bas Couwenberg pushed to branch master at Debian GIS Project / fiona
Commits:
ab0149db by Bas Couwenberg at 2018-12-01T07:49:55Z
New upstream version 1.8.3
- - - - -
cd86c8c1 by Bas Couwenberg at 2018-12-01T07:49:56Z
Merge tag 'upstream/1.8.3'
Upstream version 1.8.3
- - - - -
122cebf2 by Bas Couwenberg at 2018-12-01T07:50:13Z
New upstream release.
- - - - -
862cfdc7 by Bas Couwenberg at 2018-12-01T07:51:37Z
Set distribution to unstable.
- - - - -
12 changed files:
- .travis.yml
- CHANGES.txt
- appveyor.yml
- debian/changelog
- fiona/__init__.py
- fiona/_env.pyx
- fiona/env.py
- fiona/fio/env.py
- fiona/ogrext.pyx
- tests/test_collection.py
- tests/test_env.py
- tests/test_unicode.py
Changes:
=====================================
.travis.yml
=====================================
@@ -60,7 +60,7 @@ install:
- fio --gdal-version
script:
- - pytest --cov fiona --cov-report term-missing
+ - python -m pytest -m "not wheel" --cov fiona --cov-report term-missing
after_success:
- coveralls || echo "!! intermittent coveralls failure"
=====================================
CHANGES.txt
=====================================
@@ -3,6 +3,19 @@ Changes
All issue numbers are relative to https://github.com/Toblerity/Fiona/issues.
+1.8.3 (TBD)
+-----------
+
+- The RASTERIO_ENV config environment marker this project picked up from
+ Rasterio has been renamed to FIONA_ENV (#665).
+- Options --gdal-data and --proj-data have been added to the fio-env command so
+ that users of Rasterio wheels can get paths to set GDAL_DATA and PROJ_LIB
+ environment variables.
+- The unsuccessful attempt to make GDAL and PROJ support file discovery and
+ configuration automatic within collection's crs and crs_wkt properties has
+ been reverted. Users must execute such code inside a `with Env()` block or
+ set the GDAL_DATA and PROJ_LIB environment variables needed by GDAL.
+
1.8.2 (2018-11-19)
------------------
=====================================
appveyor.yml
=====================================
@@ -1,5 +1,4 @@
# Based on appveyor.yml from https://github.com/PDAL/PDAL and https://github.com/ogrisel/python-appveyor-demo
-#
platform: x64
@@ -27,7 +26,7 @@ environment:
GDAL_VERSION: "1.11.4"
GIS_INTERNALS: "release-1800-x64-gdal-1-11-4-mapserver-6-4-3.zip"
GIS_INTERNALS_LIBS: "release-1800-x64-gdal-1-11-4-mapserver-6-4-3-libs.zip"
-
+
- PYTHON: "C:\\Python36-x64"
PYTHON_VERSION: "3.6.4"
PYTHON_ARCH: "64"
@@ -71,7 +70,7 @@ install:
- "python --version"
- "python -c \"import struct; print(struct.calcsize('P') * 8)\""
-
+
# https://code.google.com/p/pymat2/wiki/WindowsTips
#- ps: (Get-Content "%VS90COMNTOOLS%\..\..\VC\vcvarsall.bat) | ForEach-Object { $_ -replace "vcvarsamd64.bat", "vcvars64.bat" } | Set-Content "%VS90COMNTOOLS%\..\..\VC\vcvarsall.bat
# - '%CMD_IN_ENV% echo "conv env"'
@@ -84,10 +83,10 @@ install:
- ps: mkdir C:\build | out-null
- ps: mkdir C:\gdal | out-null
-
+
- curl http://download.gisinternals.com/sdk/downloads/%GIS_INTERNALS% --output gdalbin.zip
- 7z x gdalbin.zip -oC:\gdal
- - curl http://download.gisinternals.com/sdk/downloads/%GIS_INTERNALS_LIBS% --output gdallibs.zip
+ - curl http://download.gisinternals.com/sdk/downloads/%GIS_INTERNALS_LIBS% --output gdallibs.zip
- 7z x gdallibs.zip -oC:\gdal
- "SET PATH=C:\\gdal;C:\\gdal\\bin;C:\\gdal\\data;C:\\gdal\\bin\\gdal\\apps;%PATH%"
- "SET GDAL_DATA=C:\\gdal\\bin\\gdal-data"
@@ -95,21 +94,21 @@ install:
- ECHO "Filesystem C:/GDAL:"
- ps: "ls \"C:/GDAL\""
-
-
+
+
- cd C:\projects\fiona
# Upgrade to the latest version of pip to avoid it displaying warnings
# about it being out of date.
# - "python -m pip install --disable-pip-version-check --user --upgrade pip"
-
+
- pip --version
-
+
# Install the build dependencies of the project. If some dependencies contain
# compiled extensions and are not provided as pre-built wheel packages,
# pip will build them from source using the MSVC compiler matching the
# target Python version and architecture
- "%CMD_IN_ENV% pip install -r requirements-dev.txt"
-
+
build_script:
# Build the compiled extension
@@ -136,10 +135,8 @@ test_script:
- ps: python -c "import fiona"
- # TODO: return to running test_write_gb18030 when GDAL build is updated.
- # GenericWriting test is skipped on Appveyor because our Windows GDAL doesn't
- # have iconv support and can't encode field names.
- - "%CMD_IN_ENV% python -m pytest -k \"not test_write_gb18030 and not GenericWritingTest\" --cov fiona --cov-report term-missing"
+ # Our Windows GDAL doesn't have iconv and can't support certain tests.
+ - "%CMD_IN_ENV% python -m pytest -m \"not iconv\" --cov fiona --cov-report term-missing"
matrix:
allow_failures:
=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+fiona (1.8.3-1) unstable; urgency=medium
+
+ * Team upload.
+ * New upstream release.
+
+ -- Bas Couwenberg <sebastic at debian.org> Sat, 01 Dec 2018 08:51:27 +0100
+
fiona (1.8.2-1) unstable; urgency=medium
* Team upload.
=====================================
fiona/__init__.py
=====================================
@@ -101,7 +101,7 @@ import uuid
__all__ = ['bounds', 'listlayers', 'open', 'prop_type', 'prop_width']
-__version__ = "1.8.2"
+__version__ = "1.8.3"
__gdal_version__ = get_gdal_release_name()
gdal_version = get_gdal_version_tuple()
=====================================
fiona/_env.pyx
=====================================
@@ -108,7 +108,7 @@ cdef void log_error(CPLErr err_class, int err_no, const char* msg) with gil:
if err_no in code_map:
log.log(level_map[err_class], "%s", msg)
else:
- log.info("Unknown error number %r", err_no)
+ log.info("Unknown error number %r.", err_no)
# Definition of GDAL callback functions, one for Windows and one for
@@ -235,7 +235,11 @@ cdef class ConfigEnv(object):
class GDALDataFinder(object):
- """Finds GDAL and PROJ data files"""
+ """Finds GDAL data files
+
+ Note: this class is private in 1.8.x and not in the public API.
+
+ """
def search(self, prefix=None):
"""Returns GDAL_DATA location"""
@@ -266,6 +270,11 @@ class GDALDataFinder(object):
class PROJDataFinder(object):
+ """Finds PROJ data files
+
+ Note: this class is private in 1.8.x and not in the public API.
+
+ """
def search(self, prefix=None):
"""Returns PROJ_LIB location"""
@@ -309,24 +318,25 @@ cdef class GDALEnv(ConfigEnv):
OGRRegisterAll()
log.debug("All drivers registered.")
- if 'GDAL_DATA' not in os.environ:
+ if 'GDAL_DATA' in os.environ:
+ self.update_config_options(GDAL_DATA=os.environ['GDAL_DATA'])
+ log.debug("GDAL_DATA found in environment: %r.", os.environ['GDAL_DATA'])
+ else:
path = GDALDataFinder().search()
if path:
- log.debug("GDAL data found in %r", path)
self.update_config_options(GDAL_DATA=path)
-
- else:
- self.update_config_options(GDAL_DATA=os.environ['GDAL_DATA'])
+ os.environ['GDAL_DATA'] = path
+ log.debug("GDAL_DATA not found in environment, set to %r.", path)
if 'PROJ_LIB' not in os.environ:
path = PROJDataFinder().search()
if path:
- log.debug("PROJ data found in %r", path)
os.environ['PROJ_LIB'] = path
+ log.debug("PROJ data not found in environment, set to %r.", path)
if driver_count() == 0:
CPLPopErrorHandler()
=====================================
fiona/env.py
=====================================
@@ -101,7 +101,7 @@ class Env(object):
return {
'CHECK_WITH_INVERT_PROJ': True,
'GTIFF_IMPLICIT_JPEG_OVR': False,
- "RASTERIO_ENV": True
+ "FIONA_ENV": True
}
def __init__(
=====================================
fiona/fio/env.py
=====================================
@@ -1,12 +1,12 @@
"""$ fio env"""
import json
-import logging
+import os
import click
import fiona
-from fiona.fio import with_context_env
+from fiona._env import GDALDataFinder, PROJDataFinder
@click.command(short_help="Print information about the fio environment.")
@@ -14,6 +14,10 @@ from fiona.fio import with_context_env
help="Enumerate the available formats.")
@click.option('--credentials', 'key', flag_value='credentials', default=False,
help="Print credentials.")
+ at click.option('--gdal-data', 'key', flag_value='gdal_data', default=False,
+ help="Print GDAL data path.")
+ at click.option('--proj-data', 'key', flag_value='proj_data', default=False,
+ help="Print PROJ data path.")
@click.pass_context
def env(ctx, key):
"""Print information about the Fiona environment: available
@@ -28,3 +32,7 @@ def env(ctx, key):
stdout.write('\n')
elif key == 'credentials':
click.echo(json.dumps(env.session.credentials))
+ elif key == 'gdal_data':
+ click.echo(os.environ.get('GDAL_DATA') or GDALDataFinder().search())
+ elif key == 'proj_data':
+ click.echo(os.environ.get('PROJ_LIB') or PROJDataFinder().search())
=====================================
fiona/ogrext.pyx
=====================================
@@ -22,7 +22,6 @@ from fiona._geometry cimport (
from fiona._err cimport exc_wrap_int, exc_wrap_pointer, exc_wrap_vsilfile
import fiona
-from fiona.env import env_ctx_if_needed
from fiona._env import GDALVersion, get_gdal_version_num
from fiona._err import cpl_errs, FionaNullPointerError, CPLE_BaseError, CPLE_OpenFailedError
from fiona._geometry import GEOMETRY_TYPES
@@ -631,75 +630,71 @@ cdef class Session:
if self.cogr_layer == NULL:
raise ValueError("Null layer")
- # We can't simply wrap a method in Python 2.7 so we
- # bring the context manager inside like so.
- with env_ctx_if_needed():
+ try:
+ cogr_crs = exc_wrap_pointer(OGR_L_GetSpatialRef(self.cogr_layer))
+ # TODO: we don't intend to use try/except for flow control
+ # this is a work around for a GDAL issue.
+ except FionaNullPointerError:
+ log.debug("Layer has no coordinate system")
- try:
- cogr_crs = exc_wrap_pointer(OGR_L_GetSpatialRef(self.cogr_layer))
- # TODO: we don't intend to use try/except for flow control
- # this is a work around for a GDAL issue.
- except FionaNullPointerError:
- log.debug("Layer has no coordinate system")
+ if cogr_crs is not NULL:
+
+ log.debug("Got coordinate system")
+ crs = {}
- if cogr_crs is not NULL:
+ try:
- log.debug("Got coordinate system")
- crs = {}
+ retval = OSRAutoIdentifyEPSG(cogr_crs)
+ if retval > 0:
+ log.info("Failed to auto identify EPSG: %d", retval)
try:
+ auth_key = <const char *>exc_wrap_pointer(<void *>OSRGetAuthorityName(cogr_crs, NULL))
+ auth_val = <const char *>exc_wrap_pointer(<void *>OSRGetAuthorityCode(cogr_crs, NULL))
- retval = OSRAutoIdentifyEPSG(cogr_crs)
- if retval > 0:
- log.info("Failed to auto identify EPSG: %d", retval)
-
- try:
- auth_key = <const char *>exc_wrap_pointer(<void *>OSRGetAuthorityName(cogr_crs, NULL))
- auth_val = <const char *>exc_wrap_pointer(<void *>OSRGetAuthorityCode(cogr_crs, NULL))
+ except CPLE_BaseError as exc:
+ log.debug("{}".format(exc))
- except CPLE_BaseError as exc:
- log.debug("{}".format(exc))
+ if auth_key != NULL and auth_val != NULL:
+ key_b = auth_key
+ key = key_b.decode('utf-8')
+ if key == 'EPSG':
+ val_b = auth_val
+ val = val_b.decode('utf-8')
+ crs['init'] = "epsg:" + val
- if auth_key != NULL and auth_val != NULL:
- key_b = auth_key
- key = key_b.decode('utf-8')
- if key == 'EPSG':
- val_b = auth_val
- val = val_b.decode('utf-8')
- crs['init'] = "epsg:" + val
+ else:
+ OSRExportToProj4(cogr_crs, &proj_c)
+ if proj_c == NULL:
+ raise ValueError("Null projection")
+ proj_b = proj_c
+ log.debug("Params: %s", proj_b)
+ value = proj_b.decode()
+ value = value.strip()
+ for param in value.split():
+ kv = param.split("=")
+ if len(kv) == 2:
+ k, v = kv
+ try:
+ v = float(v)
+ if v % 1 == 0:
+ v = int(v)
+ except ValueError:
+ # Leave v as a string
+ pass
+ elif len(kv) == 1:
+ k, v = kv[0], True
+ else:
+ raise ValueError("Unexpected proj parameter %s" % param)
+ k = k.lstrip("+")
+ crs[k] = v
- else:
- OSRExportToProj4(cogr_crs, &proj_c)
- if proj_c == NULL:
- raise ValueError("Null projection")
- proj_b = proj_c
- log.debug("Params: %s", proj_b)
- value = proj_b.decode()
- value = value.strip()
- for param in value.split():
- kv = param.split("=")
- if len(kv) == 2:
- k, v = kv
- try:
- v = float(v)
- if v % 1 == 0:
- v = int(v)
- except ValueError:
- # Leave v as a string
- pass
- elif len(kv) == 1:
- k, v = kv[0], True
- else:
- raise ValueError("Unexpected proj parameter %s" % param)
- k = k.lstrip("+")
- crs[k] = v
-
- finally:
- CPLFree(proj_c)
- return crs
+ finally:
+ CPLFree(proj_c)
+ return crs
- else:
- log.debug("Projection not found (cogr_crs was NULL)")
+ else:
+ log.debug("Projection not found (cogr_crs was NULL)")
return {}
@@ -710,41 +705,37 @@ cdef class Session:
if self.cogr_layer == NULL:
raise ValueError("Null layer")
- # We can't simply wrap a method in Python 2.7 so we
- # bring the context manager inside like so.
- with env_ctx_if_needed():
+ try:
+ cogr_crs = exc_wrap_pointer(OGR_L_GetSpatialRef(self.cogr_layer))
+
+ # TODO: we don't intend to use try/except for flow control
+ # this is a work around for a GDAL issue.
+ except FionaNullPointerError:
+ log.debug("Layer has no coordinate system")
+ except fiona._err.CPLE_OpenFailedError as exc:
+ log.debug("A support file wasn't opened. See the preceding ERROR level message.")
+ cogr_crs = OGR_L_GetSpatialRef(self.cogr_layer)
+ log.debug("Called OGR_L_GetSpatialRef() again without error checking.")
+ if cogr_crs == NULL:
+ raise exc
+
+ if cogr_crs is not NULL:
+ log.debug("Got coordinate system")
try:
- cogr_crs = exc_wrap_pointer(OGR_L_GetSpatialRef(self.cogr_layer))
-
- # TODO: we don't intend to use try/except for flow control
- # this is a work around for a GDAL issue.
- except FionaNullPointerError:
- log.debug("Layer has no coordinate system")
- except fiona._err.CPLE_OpenFailedError as exc:
- log.debug("A support file wasn't opened. See the preceding ERROR level message.")
- cogr_crs = OGR_L_GetSpatialRef(self.cogr_layer)
- log.debug("Called OGR_L_GetSpatialRef() again without error checking.")
- if cogr_crs == NULL:
- raise exc
-
- if cogr_crs is not NULL:
- log.debug("Got coordinate system")
-
- try:
- OSRExportToWkt(cogr_crs, &proj_c)
- if proj_c == NULL:
- raise ValueError("Null projection")
- proj_b = proj_c
- crs_wkt = proj_b.decode('utf-8')
+ OSRExportToWkt(cogr_crs, &proj_c)
+ if proj_c == NULL:
+ raise ValueError("Null projection")
+ proj_b = proj_c
+ crs_wkt = proj_b.decode('utf-8')
- finally:
- CPLFree(proj_c)
- return crs_wkt
+ finally:
+ CPLFree(proj_c)
+ return crs_wkt
- else:
- log.debug("Projection not found (cogr_crs was NULL)")
- return ""
+ else:
+ log.debug("Projection not found (cogr_crs was NULL)")
+ return ""
def get_extent(self):
cdef OGREnvelope extent
=====================================
tests/test_collection.py
=====================================
@@ -358,6 +358,7 @@ class TestUnsupportedDriver(object):
fiona.open(str(tmpdir.join("foo")), "w", "Bogus", schema=schema)
+ at pytest.mark.iconv
class TestGenericWritingTest(object):
@pytest.fixture(autouse=True)
def no_iter_shp(self, tmpdir):
=====================================
tests/test_env.py
=====================================
@@ -32,7 +32,7 @@ def test_nested_credentials(monkeypatch):
def test_ensure_env_decorator(gdalenv):
@ensure_env
def f():
- return getenv()['RASTERIO_ENV']
+ return getenv()['FIONA_ENV']
assert f() is True
=====================================
tests/test_unicode.py
=====================================
@@ -101,6 +101,7 @@ class TestUnicodeStringField(object):
assert f['properties']['label'] == u'Ba\u2019kelalan'
assert f['properties'][u'verit\xe9'] == 0
+ @pytest.mark.iconv
def test_write_gb18030(self):
"""Can write a simplified Chinese shapefile"""
schema = {
@@ -119,7 +120,7 @@ class TestUnicodeStringField(object):
assert f['properties']['label'] == u'徐汇区'
assert f['properties']['num'] == 0
- @pytest.mark.skipif(sys.platform == 'win32', reason="GDAL binary used on AppVeyor does not have a working libiconv")
+ @pytest.mark.iconv
def test_gb2312_field_wrong_encoding(self):
"""Attempt to create field with a name not supported by the encoding
@@ -148,4 +149,3 @@ class TestUnicodeStringField(object):
# no encoding
with pytest.raises(SchemaError):
fiona.open(os.path.join(self.tempdir, "test2.shp"), "w", **meta)
-
View it on GitLab: https://salsa.debian.org/debian-gis-team/fiona/compare/d454d6af7f1841496686adee2ccf65db34e04643...862cfdc78d6dc476c35c05792ba2391c6102edee
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/fiona/compare/d454d6af7f1841496686adee2ccf65db34e04643...862cfdc78d6dc476c35c05792ba2391c6102edee
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/20181201/f3d3dd8a/attachment-0001.html>
More information about the Pkg-grass-devel
mailing list