Skip to content
Commits on Source (4)
......@@ -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"
......
......@@ -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)
------------------
......
# Based on appveyor.yml from https://github.com/PDAL/PDAL and https://github.com/ogrisel/python-appveyor-demo
#
platform: x64
......@@ -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:
......
fiona (1.8.3-1) unstable; urgency=medium
* Team upload.
* New upstream release.
-- Bas Couwenberg <sebastic@debian.org> Sat, 01 Dec 2018 08:51:27 +0100
fiona (1.8.2-1) unstable; urgency=medium
* Team upload.
......
......@@ -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()
......
......@@ -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()
......
......@@ -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__(
......
"""$ 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.")
@click.option('--gdal-data', 'key', flag_value='gdal_data', default=False,
help="Print GDAL data path.")
@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())
......@@ -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,10 +630,6 @@ 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
......@@ -710,10 +705,6 @@ 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))
......
......@@ -358,6 +358,7 @@ class TestUnsupportedDriver(object):
fiona.open(str(tmpdir.join("foo")), "w", "Bogus", schema=schema)
@pytest.mark.iconv
class TestGenericWritingTest(object):
@pytest.fixture(autouse=True)
def no_iter_shp(self, tmpdir):
......
......@@ -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
......
......@@ -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)