[fiona] 01/04: Revert "Merge tag 'upstream/1.6.1'"
Johan Van de Wauw
johanvdw-guest at moszumanska.debian.org
Sat Aug 22 20:00:08 UTC 2015
This is an automated email from the git hooks/post-receive script.
johanvdw-guest pushed a commit to branch master
in repository fiona.
commit 4190039733c9febc2f810f1370b97c2f138b1c86
Author: Johan Van de Wauw <johan.vandewauw at gmail.com>
Date: Sat Aug 22 21:21:50 2015 +0200
Revert "Merge tag 'upstream/1.6.1'"
This reverts commit e2a847c6726f38522e076155544f3a94086032e5, reversing
changes made to d46f76057275fc9a4dc2d4ddb28f471fae7c4cda.
Note I'm returning to fiona 1.6.0 because 1.6.1 requires python-click-plugins
which is currently in NEW.
---
CHANGES.txt | 13 -----
CREDITS.txt | 48 +++++++++----------
debian/changelog | 4 +-
fiona/__init__.py | 2 +-
fiona/fio/info.py | 34 ++++---------
fiona/fio/main.py | 8 ++--
fiona/ogrext.pyx | 24 +---------
setup.py | 8 +---
tests/test_props.py | 135 +---------------------------------------------------
9 files changed, 45 insertions(+), 231 deletions(-)
diff --git a/CHANGES.txt b/CHANGES.txt
index fbbf1ef..b6b043b 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,19 +1,6 @@
Changes
=======
-All issue numbers are relative to https://github.com/Toblerity/Fiona/issues.
-
-1.6.1 (2015-08-12)
-------------------
-- Bug fix: Fiona now deserializes JSON-encoded string properties provided by
- the OGR GeoJSON driver (#244, #245, #246).
-- Bug fix: proj4 data was not copied properly into binary distributions due to
- a typo (#254).
-
-Special thanks to WFMU DJ Liz Berg for the awesome playlist that's fueling my
-release sprint. Check it out at http://wfmu.org/playlists/shows/62083. You
-can't unhear Love Coffin.
-
1.6.0 (2015-07-21)
------------------
- Upgrade Cython requirement to 0.22 (#214).
diff --git a/CREDITS.txt b/CREDITS.txt
index d4d28b7..03a2998 100644
--- a/CREDITS.txt
+++ b/CREDITS.txt
@@ -3,30 +3,30 @@ Credits
Fiona is written by:
-- Sean Gillies <sean.gillies at gmail.com>
-- Kevin Wurster <wursterk at gmail.com>
-- René Buffat <buffat at gmail.com>
-- Kelsey Jordahl <kjordahl at enthought.com>
-- Patrick Young <patrick.young at digitalglobe.com>
-- Hannes Gräuler <graeuler at geoplex.de>
-- Johan Van de Wauw <johan.vandewauw at gmail.com>
-- Jacob Wasserman <jwasserman at gmail.com>
-- Joshua Arnott <josh at snorfalorpagus.net>
-- Ryan Grout <rgrout at continuum.io>
-- Michael Weisman <mweisman at gmail.com>
-- Brendan Ward <bcward at consbio.org>
-- Michele Citterio <michele at citterio.net>
-- Miro Hrončok <miro at hroncok.cz>
-- fredj <frederic.junod at camptocamp.com>
-- wilsaj <wilson.andrew.j+github at gmail.com>
-- Brandon Liu <bdon at bdon.org>
-- Hannes Gräuler <hgraeule at uos.de>
-- Ludovic Delauné <ludotux at gmail.com>
-- Martijn Visser <mgvisser at gmail.com>
-- Oliver Tonnhofer <olt at bogosoft.com>
-- Stefano Costa <steko at iosa.it>
-- dimlev <dimlev at gmail.com>
-- Ariel Nunez <ingenieroariel at gmail.com>
+* Sean Gillies <sean.gillies at gmail.com>
+* Rene Buffat <buffat at gmail.com>
+* Kevin Wurster <wursterk at gmail.com>
+* Kelsey Jordahl <kjordahl at enthought.com>
+* Patrick Young <patrick.mckendree.young at gmail.com>
+* Hannes Gräuler <graeuler at geoplex.de>
+* Ryan Grout <rgrout at continuum.io>
+* Michael Weisman <mweisman at gmail.com>
+* Joshua Arnott <josh at snorfalorpagus.net>
+* Jacob Wasserman <jwasserman at gmail.com>
+* Miro Hrončok <miro at hroncok.cz>
+* Michele Citterio <michele at citterio.net>
+* Johan Van de Wauw <johan.vandewauw at gmail.com>
+* fredj <frederic.junod at camptocamp.com>
+* Brendan Ward <bcward at consbio.org>
+* wilsaj <wilson.andrew.j+github at gmail.com>
+* Stefano Costa <steko at iosa.it>
+* Oliver Tonnhofer <olt at bogosoft.com>
+* Martijn Visser <mgvisser at gmail.com>
+* Ludovic Delauné <ludotux at gmail.com>
+* Hannes Gräuler <hgraeule at uos.de>
+* dimlev <dimlev at gmail.com>
+* Brandon Liu <bdon at bdon.org>
+* Ariel Nunez <ingenieroariel at gmail.com>
Fiona would not be possible without the great work of Frank Warmerdam and other
GDAL/OGR developers.
diff --git a/debian/changelog b/debian/changelog
index c3bea49..d4dd498 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,9 +1,7 @@
-fiona (1.6.1-1) UNRELEASED; urgency=medium
+fiona (1.6.0-1) UNRELEASED; urgency=medium
* Imported Upstream version 1.6.0
* Fix patch for new release
- * Skip tests as in travis build
- * Imported Upstream version 1.6.1
-- Johan Van de Wauw <johan.vandewauw at gmail.com> Sun, 02 Aug 2015 01:10:12 +0200
diff --git a/fiona/__init__.py b/fiona/__init__.py
index 4c45226..5eac18c 100644
--- a/fiona/__init__.py
+++ b/fiona/__init__.py
@@ -63,7 +63,7 @@ writing modes) flush contents to disk when their ``with`` blocks end.
"""
__all__ = ['bounds', 'listlayers', 'open', 'prop_type', 'prop_width']
-__version__ = "1.6.1"
+__version__ = "1.6.0"
import logging
import os
diff --git a/fiona/fio/info.py b/fiona/fio/info.py
index fde48c0..96080f4 100644
--- a/fiona/fio/info.py
+++ b/fiona/fio/info.py
@@ -53,7 +53,7 @@ def env(ctx, key):
@click.pass_context
def info(ctx, input, indent, meta_member):
verbosity = (ctx.obj and ctx.obj['verbosity']) or 2
- logger = logging.getLogger('fio')
+ logger = logging.getLogger('rio')
try:
with fiona.drivers(CPL_DEBUG=verbosity>2):
with fiona.open(input) as src:
@@ -79,34 +79,20 @@ def info(ctx, input, indent, meta_member):
# Insp command.
@click.command(short_help="Open a dataset and start an interpreter.")
@click.argument('src_path', type=click.Path(exists=True))
- at click.option('--ipython', 'interpreter', flag_value='ipython',
- help="Use IPython as interpreter.")
@click.pass_context
-def insp(ctx, src_path, interpreter):
-
+def insp(ctx, src_path):
verbosity = (ctx.obj and ctx.obj['verbosity']) or 2
logger = logging.getLogger('fio')
-
- banner = 'Fiona %s Interactive Inspector (Python %s)\n' \
- 'Type "src.schema", "next(src)", or "help(src)" ' \
- 'for more information.' \
- % (fiona.__version__, '.'.join(map(str, sys.version_info[:3])))
-
try:
- with fiona.drivers(CPL_DEBUG=verbosity > 2):
+ with fiona.drivers(CPL_DEBUG=verbosity>2):
with fiona.open(src_path) as src:
-
- scope = locals()
-
- if not interpreter:
- code.interact(banner, local=scope)
- elif interpreter == 'ipython':
- import IPython
- IPython.InteractiveShell.banner1 = banner
- IPython.start_ipython(argv=[], user_ns=scope)
- else:
- raise click.ClickException('Interpreter %s is unsupported or missing '
- 'dependencies' % interpreter)
+ code.interact(
+ 'Fiona %s Interactive Inspector (Python %s)\n'
+ 'Type "src.schema", "next(src)", or "help(src)" '
+ 'for more information.' % (
+ fiona.__version__, '.'.join(
+ map(str, sys.version_info[:3]))),
+ local=locals())
except Exception:
logger.exception("Exception caught during processing")
diff --git a/fiona/fio/main.py b/fiona/fio/main.py
index f1670f9..758ff42 100644
--- a/fiona/fio/main.py
+++ b/fiona/fio/main.py
@@ -9,8 +9,8 @@ import warnings
import sys
import click
-from click_plugins import with_plugins
from cligj import verbose_opt, quiet_opt
+import cligj.plugins
from fiona import __version__ as fio_version
@@ -20,9 +20,9 @@ def configure_logging(verbosity):
logging.basicConfig(stream=sys.stderr, level=log_level)
- at with_plugins(ep for ep in list(iter_entry_points('fiona.fio_commands')) +
- list(iter_entry_points('fiona.fio_plugins')))
- at click.group()
+ at cligj.plugins.group(plugins=(
+ ep for ep in list(iter_entry_points('fiona.fio_commands')) +
+ list(iter_entry_points('fiona.fio_plugins'))))
@verbose_opt
@quiet_opt
@click.version_option(fio_version)
diff --git a/fiona/ogrext.pyx b/fiona/ogrext.pyx
index 4defcb1..3434553 100644
--- a/fiona/ogrext.pyx
+++ b/fiona/ogrext.pyx
@@ -1,7 +1,6 @@
# These are extension functions and classes using the OGR C API.
import datetime
-import json
import locale
import logging
import os
@@ -166,7 +165,6 @@ cdef class FeatureBuilder:
key,
ograpi.OGR_Fld_GetType(fdefn))
continue
-
# TODO: other types
fieldtype = FIELD_TYPES_MAP[fieldtypename]
if not ograpi.OGR_F_IsFieldSet(feature, i):
@@ -175,26 +173,14 @@ cdef class FeatureBuilder:
props[key] = ograpi.OGR_F_GetFieldAsInteger(feature, i)
elif fieldtype is float:
props[key] = ograpi.OGR_F_GetFieldAsDouble(feature, i)
-
elif fieldtype is text_type:
try:
val = ograpi.OGR_F_GetFieldAsString(feature, i)
- val = val.decode(encoding)
+ props[key] = val.decode(encoding)
except UnicodeDecodeError:
log.warn(
"Failed to decode %s using %s codec", val, encoding)
-
- # Does the text contain a JSON object? Let's check.
- # Let's check as cheaply as we can.
- if val.startswith('{'):
- try:
- val = json.loads(val)
- except ValueError as err:
- log.warn(str(err))
-
- # Now add to the properties object.
- props[key] = val
-
+ props[key] = val
elif fieldtype in (FionaDateType, FionaTimeType, FionaDateTimeType):
retval = ograpi.OGR_F_GetFieldAsDateTime(
feature, i, &y, &m, &d, &hh, &mm, &ss, &tz)
@@ -267,12 +253,6 @@ cdef class OGRFeatureBuilder:
i = ograpi.OGR_F_GetFieldIndex(cogr_feature, key_c)
if i < 0:
continue
-
- # Special case: serialize dicts to assist OGR.
- if isinstance(value, dict):
- value = json.dumps(value)
-
- # Continue over the standard OGR types.
if isinstance(value, integer_types):
ograpi.OGR_F_SetFieldInteger(cogr_feature, i, value)
elif isinstance(value, float):
diff --git a/setup.py b/setup.py
index eaece39..0deb1fd 100644
--- a/setup.py
+++ b/setup.py
@@ -122,7 +122,7 @@ if os.environ.get('PACKAGE_DATA'):
projdatadir = os.environ.get('PROJ_LIB', '/usr/local/share/proj')
if os.path.exists(projdatadir):
log.info("Copying proj data from %s" % projdatadir)
- copy_data_tree(projdatadir, 'fiona/proj_data')
+ copy_data_tree(projdatadir, 'finoa/proj_data')
ext_options = dict(
include_dirs=include_dirs,
@@ -153,11 +153,7 @@ else:
Extension('fiona._err', ['fiona/_err.c'], **ext_options),
Extension('fiona.ogrext', ['fiona/ogrext.c'], **ext_options)]
-requirements = [
- 'cligj',
- 'click-plugins',
- 'six'
-]
+requirements = ['cligj', 'six']
if sys.version_info < (2, 7):
requirements.append('argparse')
requirements.append('ordereddict')
diff --git a/tests/test_props.py b/tests/test_props.py
index 7f36a3b..41295f7 100644
--- a/tests/test_props.py
+++ b/tests/test_props.py
@@ -1,153 +1,20 @@
-import json
-import os.path
-from six import text_type
-import tempfile
-import fiona
+from six import text_type
from fiona import prop_type, prop_width
from fiona.rfc3339 import FionaDateType
-
def test_width_str():
assert prop_width('str:254') == 254
assert prop_width('str') == 80
-
def test_width_other():
assert prop_width('int') == None
assert prop_width('float') == None
assert prop_width('date') == None
-
def test_types():
assert prop_type('str:254') == text_type
assert prop_type('str') == text_type
assert prop_type('int') == type(0)
assert prop_type('float') == type(0.0)
assert prop_type('date') == FionaDateType
-
-
-def test_read_json_object_properties():
- """JSON object properties are properly serialized"""
- data = """
-{
- "type": "FeatureCollection",
- "features": [
- {
- "geometry": {
- "type": "Polygon",
- "coordinates": [
- [
- [
- 87.33588,
- 43.53139
- ],
- [
- 87.33588,
- 45.66894
- ],
- [
- 90.27542,
- 45.66894
- ],
- [
- 90.27542,
- 43.53139
- ],
- [
- 87.33588,
- 43.53139
- ]
- ]
- ]
- },
- "type": "Feature",
- "properties": {
- "upperLeftCoordinate": {
- "latitude": 45.66894,
- "longitude": 87.91166
- },
- "tricky": "{gotcha"
- }
- }
- ]
-}
-"""
- tmpdir = tempfile.mkdtemp()
- filename = os.path.join(tmpdir, 'test.json')
-
- with open(filename, 'w') as f:
- f.write(data)
-
- with fiona.open(filename) as src:
- ftr = next(src)
- props = ftr['properties']
- assert props['upperLeftCoordinate']['latitude'] == 45.66894
- assert props['upperLeftCoordinate']['longitude'] == 87.91166
- assert props['tricky'] == "{gotcha"
-
-
-def test_write_json_object_properties():
- """Python object properties are properly serialized"""
- data = """
-{
- "type": "FeatureCollection",
- "features": [
- {
- "geometry": {
- "type": "Polygon",
- "coordinates": [
- [
- [
- 87.33588,
- 43.53139
- ],
- [
- 87.33588,
- 45.66894
- ],
- [
- 90.27542,
- 45.66894
- ],
- [
- 90.27542,
- 43.53139
- ],
- [
- 87.33588,
- 43.53139
- ]
- ]
- ]
- },
- "type": "Feature",
- "properties": {
- "upperLeftCoordinate": {
- "latitude": 45.66894,
- "longitude": 87.91166
- },
- "tricky": "{gotcha"
- }
- }
- ]
-}
-"""
- data = json.loads(data)['features'][0]
- tmpdir = tempfile.mkdtemp()
- filename = os.path.join(tmpdir, 'test.json')
- with fiona.open(
- filename, 'w',
- driver='GeoJSON',
- schema={
- 'geometry': 'Polygon',
- 'properties': {'upperLeftCoordinate': 'str', 'tricky': 'str'}}
- ) as dst:
- dst.write(data)
-
- with fiona.open(filename) as src:
- ftr = next(src)
- props = ftr['properties']
- assert props['upperLeftCoordinate']['latitude'] == 45.66894
- assert props['upperLeftCoordinate']['longitude'] == 87.91166
- assert props['tricky'] == "{gotcha"
--
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