[Git][debian-gis-team/python-shapely][master] 4 commits: New upstream version 1.8.4
Bas Couwenberg (@sebastic)
gitlab at salsa.debian.org
Thu Aug 18 04:29:24 BST 2022
Bas Couwenberg pushed to branch master at Debian GIS Project / python-shapely
Commits:
772b00de by Bas Couwenberg at 2022-08-18T05:21:04+02:00
New upstream version 1.8.4
- - - - -
fd2b7105 by Bas Couwenberg at 2022-08-18T05:21:07+02:00
Update upstream source from tag 'upstream/1.8.4'
Update to upstream version '1.8.4'
with Debian dir b32d2e92c8ff97aab41300e4d62962eba67a6090
- - - - -
101ed8f3 by Bas Couwenberg at 2022-08-18T05:21:20+02:00
New upstream release.
- - - - -
8afa5f67 by Bas Couwenberg at 2022-08-18T05:22:12+02:00
Set distribution to unstable.
- - - - -
13 changed files:
- CHANGES.txt
- debian/changelog
- shapely/__init__.py
- shapely/ctypes_declarations.py
- shapely/geometry/base.py
- shapely/geometry/collection.py
- shapely/geometry/multilinestring.py
- shapely/geometry/multipoint.py
- shapely/geometry/multipolygon.py
- shapely/geometry/polygon.py
- shapely/ops.py
- shapely/strtree.py
- shapely/topology.py
Changes:
=====================================
CHANGES.txt
=====================================
@@ -1,6 +1,13 @@
Changes
=======
+1.8.4 (2022-08-17)
+------------------
+
+Bug fixes:
+
+- The new c_geom_p type caused a regression and has been removed (#1487).
+
1.8.3 (2022-08-16)
------------------
=====================================
debian/changelog
=====================================
@@ -1,3 +1,9 @@
+python-shapely (1.8.4-1) unstable; urgency=medium
+
+ * New upstream release.
+
+ -- Bas Couwenberg <sebastic at debian.org> Thu, 18 Aug 2022 05:21:58 +0200
+
python-shapely (1.8.3-1) unstable; urgency=medium
* New upstream release.
=====================================
shapely/__init__.py
=====================================
@@ -1 +1 @@
-__version__ = "1.8.3"
+__version__ = "1.8.4"
=====================================
shapely/ctypes_declarations.py
=====================================
@@ -3,19 +3,8 @@
See header file: geos-x.y.z/capi/geos_c.h
'''
-from ctypes import (
- CFUNCTYPE,
- POINTER,
- Structure,
- c_void_p,
- c_char_p,
- c_size_t,
- c_byte,
- c_uint,
- c_int,
- c_double,
- py_object,
-)
+from ctypes import CFUNCTYPE, POINTER, c_void_p, c_char_p, \
+ c_size_t, c_byte, c_uint, c_int, c_double, py_object
from .errors import UnsupportedGEOSVersionError
@@ -31,13 +20,6 @@ class allocated_c_char_p(c_char_p):
pass
-class GEOSGeom_t(Structure):
- pass
-
-
-c_geom_p = POINTER(GEOSGeom_t)
-
-
def prototype(lgeos, geos_version):
"""Protype functions in geos_c.h for different version of GEOS
@@ -173,25 +155,25 @@ def prototype(lgeos, geos_version):
# Geometry constructors
- lgeos.GEOSGeom_createPoint.restype = c_geom_p
+ lgeos.GEOSGeom_createPoint.restype = c_void_p
lgeos.GEOSGeom_createPoint.argtypes = [c_void_p]
- lgeos.GEOSGeom_createLinearRing.restype = c_geom_p
+ lgeos.GEOSGeom_createLinearRing.restype = c_void_p
lgeos.GEOSGeom_createLinearRing.argtypes = [c_void_p]
- lgeos.GEOSGeom_createLineString.restype = c_geom_p
+ lgeos.GEOSGeom_createLineString.restype = c_void_p
lgeos.GEOSGeom_createLineString.argtypes = [c_void_p]
- lgeos.GEOSGeom_createPolygon.restype = c_geom_p
- lgeos.GEOSGeom_createPolygon.argtypes = [c_geom_p, POINTER(c_geom_p), c_uint]
+ lgeos.GEOSGeom_createPolygon.restype = c_void_p
+ lgeos.GEOSGeom_createPolygon.argtypes = [c_void_p, c_void_p, c_uint]
- lgeos.GEOSGeom_createCollection.restype = c_geom_p
- lgeos.GEOSGeom_createCollection.argtypes = [c_int, POINTER(c_geom_p), c_uint]
+ lgeos.GEOSGeom_createCollection.restype = c_void_p
+ lgeos.GEOSGeom_createCollection.argtypes = [c_int, c_void_p, c_uint]
- lgeos.GEOSGeom_createEmptyCollection.restype = c_geom_p
+ lgeos.GEOSGeom_createEmptyCollection.restype = c_void_p
lgeos.GEOSGeom_createEmptyCollection.argtypes = [c_int]
- lgeos.GEOSGeom_clone.restype = c_geom_p
+ lgeos.GEOSGeom_clone.restype = c_void_p
lgeos.GEOSGeom_clone.argtypes = [c_void_p]
# Memory management
@@ -243,13 +225,9 @@ def prototype(lgeos, geos_version):
lgeos.GEOSPolygonize.restype = c_void_p
lgeos.GEOSPolygonize.argtypes = [c_void_p, c_uint]
- lgeos.GEOSPolygonize_full.restype = c_geom_p
+ lgeos.GEOSPolygonize_full.restype = c_void_p
lgeos.GEOSPolygonize_full.argtypes = [
- c_geom_p,
- POINTER(c_geom_p),
- POINTER(c_geom_p),
- POINTER(c_geom_p),
- ]
+ c_void_p, c_void_p, c_void_p, c_void_p]
if geos_version >= (3, 4, 0):
lgeos.GEOSDelaunayTriangulation.restype = c_void_p
@@ -419,16 +397,16 @@ def prototype(lgeos, geos_version):
# Misc functions
lgeos.GEOSArea.restype = c_int
- lgeos.GEOSArea.argtypes = [c_geom_p, POINTER(c_double)]
+ lgeos.GEOSArea.argtypes = [c_void_p, POINTER(c_double)]
lgeos.GEOSLength.restype = c_int
- lgeos.GEOSLength.argtypes = [c_geom_p, POINTER(c_double)]
+ lgeos.GEOSLength.argtypes = [c_void_p, POINTER(c_double)]
lgeos.GEOSDistance.restype = c_int
- lgeos.GEOSDistance.argtypes = [c_geom_p, c_geom_p, POINTER(c_double)]
+ lgeos.GEOSDistance.argtypes = [c_void_p, c_void_p, POINTER(c_double)]
lgeos.GEOSHausdorffDistance.restype = c_int
- lgeos.GEOSHausdorffDistance.argtypes = [c_geom_p, c_geom_p, POINTER(c_double)]
+ lgeos.GEOSHausdorffDistance.argtypes = [c_void_p, c_void_p, POINTER(c_double)]
# Reader and Writer APIs
@@ -546,7 +524,7 @@ def prototype(lgeos, geos_version):
c_void_p, py_object, c_void_p, lgeos.GEOSDistanceCallback, py_object]
lgeos.GEOSSTRtree_nearest_generic.restype = c_void_p
- lgeos.GEOSMinimumClearance.argtypes = [c_geom_p, POINTER(c_double)]
+ lgeos.GEOSMinimumClearance.argtypes = [c_void_p, POINTER(c_double)]
lgeos.GEOSMinimumClearance.restype = c_int
if geos_version >= (3, 8, 0):
=====================================
shapely/geometry/base.py
=====================================
@@ -7,7 +7,7 @@ different z values may intersect or be equal.
"""
from binascii import a2b_hex
-from ctypes import cast, pointer, c_size_t, c_char_p, c_void_p
+from ctypes import pointer, c_size_t, c_char_p, c_void_p
from itertools import islice
import logging
import math
@@ -18,7 +18,6 @@ import warnings
from shapely.affinity import affine_transform
from shapely.coords import CoordinateSequence
-from shapely.ctypes_declarations import c_geom_p
from shapely.errors import GeometryTypeError, WKBReadingError, WKTReadingError
from shapely.errors import ShapelyDeprecationWarning
from shapely.geos import WKBWriter, WKTWriter
@@ -108,11 +107,10 @@ def geos_geom_from_py(ob, create_func=None):
This behaviour is useful for converting between LineString and LinearRing
objects.
"""
- geom_ptr = cast(ob._geom, c_geom_p)
if create_func is None:
- geom = lgeos.GEOSGeom_clone(geom_ptr)
+ geom = lgeos.GEOSGeom_clone(ob._geom)
else:
- cs = lgeos.GEOSGeom_getCoordSeq(geom_ptr)
+ cs = lgeos.GEOSGeom_getCoordSeq(ob._geom)
cs = lgeos.GEOSCoordSeq_clone(cs)
geom = create_func(cs)
=====================================
shapely/geometry/collection.py
=====================================
@@ -3,7 +3,6 @@
from ctypes import c_void_p
-from shapely.ctypes_declarations import c_geom_p
from shapely.geos import lgeos
from shapely.geometry.base import BaseGeometry
from shapely.geometry.base import BaseMultipartGeometry
@@ -64,7 +63,7 @@ def geos_geometrycollection_from_py(ob):
ob = ob.geoms
L = len(ob)
N = 2
- subs = (c_geom_p * L)()
+ subs = (c_void_p * L)()
for l in range(L):
assert(isinstance(ob[l], BaseGeometry))
if ob[l].has_z:
=====================================
shapely/geometry/multilinestring.py
=====================================
@@ -4,7 +4,6 @@
from ctypes import c_void_p, cast
import warnings
-from shapely.ctypes_declarations import c_geom_p
from shapely.errors import EmptyPartError, ShapelyDeprecationWarning
from shapely.geos import lgeos
from shapely.geometry.base import BaseMultipartGeometry, geos_geom_from_py
@@ -117,9 +116,9 @@ def asMultiLineString(context):
def geos_multilinestring_from_py(ob):
- # ob must be either a MultiLineString, a sequence, or
+ # ob must be either a MultiLineString, a sequence, or
# array of sequences or arrays
-
+
if isinstance(ob, MultiLineString):
return geos_geom_from_py(ob)
@@ -135,8 +134,8 @@ def geos_multilinestring_from_py(ob):
raise ValueError("Invalid coordinate dimensionality")
# Array of pointers to point geometries
- subs = (c_geom_p * L)()
-
+ subs = (c_void_p * L)()
+
# add to coordinate sequence
for l in range(L):
geom, ndims = linestring.geos_linestring_from_py(obs[l])
@@ -144,6 +143,6 @@ def geos_multilinestring_from_py(ob):
if lgeos.GEOSisEmpty(geom):
raise EmptyPartError("Can't create MultiLineString with empty component")
- subs[l] = cast(geom, c_geom_p)
-
+ subs[l] = cast(geom, c_void_p)
+
return (lgeos.GEOSGeom_createCollection(5, subs, L), N)
=====================================
shapely/geometry/multipoint.py
=====================================
@@ -4,7 +4,6 @@
from ctypes import byref, c_double, c_void_p, cast
import warnings
-from shapely.ctypes_declarations import c_geom_p
from shapely.errors import EmptyPartError, ShapelyDeprecationWarning
from shapely.geos import lgeos
from shapely.geometry.base import (
@@ -195,7 +194,7 @@ def geos_multipoint_from_py(ob):
assert n == 2 or n == 3
# Array of pointers to point geometries
- subs = (c_geom_p * m)()
+ subs = (c_void_p * m)()
# add to coordinate sequence
for i in range(m):
@@ -205,6 +204,6 @@ def geos_multipoint_from_py(ob):
if lgeos.GEOSisEmpty(geom):
raise EmptyPartError("Can't create MultiPoint with empty component")
- subs[i] = cast(geom, c_geom_p)
+ subs[i] = cast(geom, c_void_p)
return lgeos.GEOSGeom_createCollection(4, subs, m), n
=====================================
shapely/geometry/multipolygon.py
=====================================
@@ -4,7 +4,6 @@
from ctypes import c_void_p, cast
import warnings
-from shapely.ctypes_declarations import c_geom_p
from shapely.errors import ShapelyDeprecationWarning
from shapely.geos import lgeos
from shapely.geometry.base import BaseMultipartGeometry, geos_geom_from_py
@@ -147,10 +146,10 @@ def geos_multipolygon_from_py(ob):
N = len(ob[0][0][0])
assert N == 2 or N == 3
- subs = (c_geom_p * L)()
+ subs = (c_void_p * L)()
for l in range(L):
geom, ndims = polygon.geos_polygon_from_py(ob[l][0], ob[l][1:])
- subs[l] = cast(geom, c_geom_p)
+ subs[l] = cast(geom, c_void_p)
return (lgeos.GEOSGeom_createCollection(6, subs, L), N)
@@ -193,7 +192,7 @@ def geos_multipolygon_from_polygons(arg):
assert N == 2 or N == 3
- subs = (c_geom_p * L)()
+ subs = (c_void_p * L)()
for i, ob in enumerate(obs):
if isinstance(ob, polygon.Polygon):
@@ -204,6 +203,6 @@ def geos_multipolygon_from_polygons(arg):
holes = ob[1]
geom, ndims = polygon.geos_polygon_from_py(shell, holes)
- subs[i] = cast(geom, c_geom_p)
+ subs[i] = cast(geom, c_void_p)
return (lgeos.GEOSGeom_createCollection(6, subs, L), N)
=====================================
shapely/geometry/polygon.py
=====================================
@@ -9,7 +9,6 @@ import weakref
from shapely.algorithms.cga import signed_area
from shapely.coords import CoordinateSequence
-from shapely.ctypes_declarations import c_geom_p
from shapely.geos import lgeos
from shapely.geometry.base import BaseGeometry, geos_geom_from_py
from shapely.geometry.linestring import LineString, LineStringAdapter
@@ -556,17 +555,16 @@ def geos_polygon_from_py(shell, holes=None):
raise ValueError("insufficiant coordinate dimension")
# Array of pointers to ring geometries
- geos_holes = (c_geom_p * L)()
+ geos_holes = (c_void_p * L)()
# add to coordinate sequence
for l in range(L):
geom, ndim = geos_linearring_from_py(ob[l])
- geos_holes[l] = cast(geom, c_geom_p)
+ geos_holes[l] = cast(geom, c_void_p)
else:
- geos_holes = POINTER(c_geom_p)()
+ geos_holes = POINTER(c_void_p)()
L = 0
return (
- lgeos.GEOSGeom_createPolygon(cast(geos_shell, c_geom_p), geos_holes, L),
- ndim,
- )
+ lgeos.GEOSGeom_createPolygon(
+ c_void_p(geos_shell), geos_holes, L), ndim)
=====================================
shapely/ops.py
=====================================
@@ -1,10 +1,9 @@
"""Support for various GEOS geometry operations
"""
-from ctypes import byref, cast, c_void_p, c_double
+from ctypes import byref, c_void_p, c_double
from warnings import warn
-from shapely.ctypes_declarations import c_geom_p
from shapely.errors import GeometryTypeError, ShapelyDeprecationWarning
from shapely.prepared import prep
from shapely.geos import lgeos
@@ -45,16 +44,12 @@ class CollectionOperator:
source = [source]
finally:
obs = [self.shapeup(l) for l in source]
-
- geom_array_type = c_geom_p * len(obs)
+ geom_array_type = c_void_p * len(obs)
geom_array = geom_array_type()
-
for i, line in enumerate(obs):
- geom_array[i] = cast(line._geom, c_geom_p)
-
+ geom_array[i] = line._geom
product = lgeos.GEOSPolygonize(byref(geom_array), len(obs))
collection = geom_factory(product)
-
for g in collection.geoms:
clone = lgeos.GEOSGeom_clone(g._geom)
g = geom_factory(clone)
@@ -83,21 +78,16 @@ class CollectionOperator:
source = [source]
finally:
obs = [self.shapeup(l) for l in source]
-
L = len(obs)
- subs = (c_geom_p * L)()
-
+ subs = (c_void_p * L)()
for i, g in enumerate(obs):
- subs[i] = cast(g._geom, c_geom_p)
-
+ subs[i] = g._geom
collection = lgeos.GEOSGeom_createCollection(5, subs, L)
- dangles = c_geom_p()
- cuts = c_geom_p()
- invalids = c_geom_p()
+ dangles = c_void_p()
+ cuts = c_void_p()
+ invalids = c_void_p()
product = lgeos.GEOSPolygonize_full(
- collection, byref(dangles), byref(cuts), byref(invalids)
- )
-
+ collection, byref(dangles), byref(cuts), byref(invalids))
return (
geom_factory(product),
geom_factory(dangles),
@@ -145,12 +135,9 @@ class CollectionOperator:
except TypeError:
geoms = [geoms]
L = 1
-
- subs = (c_geom_p * L)()
-
+ subs = (c_void_p * L)()
for i, g in enumerate(geoms):
- subs[i] = cast(g._geom, c_geom_p)
-
+ subs[i] = g._geom
collection = lgeos.GEOSGeom_createCollection(6, subs, L)
return geom_factory(lgeos.methods['cascaded_union'](collection))
@@ -167,12 +154,9 @@ class CollectionOperator:
except TypeError:
geoms = [geoms]
L = 1
-
- subs = (c_geom_p * L)()
-
+ subs = (c_void_p * L)()
for i, g in enumerate(geoms):
- subs[i] = cast(g._geom, c_geom_p)
-
+ subs[i] = g._geom
collection = lgeos.GEOSGeom_createCollection(6, subs, L)
return geom_factory(lgeos.methods['unary_union'](collection))
=====================================
shapely/strtree.py
=====================================
@@ -24,7 +24,6 @@ from typing import Any, ItemsView, Iterable, Iterator, Optional, Sequence, Tuple
import sys
from warnings import warn
-from shapely.ctypes_declarations import c_geom_p
from shapely.errors import ShapelyDeprecationWarning
from shapely.geometry.base import BaseGeometry
from shapely.geos import lgeos
@@ -264,8 +263,8 @@ class STRtree:
dist[0] = sys.float_info.max
else:
lgeos.GEOSDistance(
- ctypes.cast(self._geoms[idx]._geom, c_geom_p),
- ctypes.cast(geom2._geom, c_geom_p),
+ self._geoms[idx]._geom,
+ geom2._geom,
dist,
)
return 1
=====================================
shapely/topology.py
=====================================
@@ -9,7 +9,6 @@ These methods return ctypes objects that should be recast by the caller.
from ctypes import byref, cast, c_double
-from shapely.ctypes_declarations import c_geom_p
from shapely.geos import TopologicalError, lgeos
from shapely.errors import InvalidGeometryError
@@ -49,9 +48,7 @@ class BinaryRealProperty(Delegating):
self._validate(this)
self._validate(other, stop_prepared=True)
d = c_double()
- retval = self.fn(
- cast(this._geom, c_geom_p), cast(other._geom, c_geom_p), byref(d)
- )
+ retval = self.fn(this._geom, other._geom, byref(d))
return d.value
@@ -60,7 +57,7 @@ class UnaryRealProperty(Delegating):
def __call__(self, this):
self._validate(this)
d = c_double()
- retval = self.fn(cast(this._geom, c_geom_p), byref(d))
+ retval = self.fn(this._geom, byref(d))
return d.value
View it on GitLab: https://salsa.debian.org/debian-gis-team/python-shapely/-/compare/e1b5360e82f459daf83649367479da2aefe2503a...8afa5f6777b13a657658ba5000632d0292d626b6
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/python-shapely/-/compare/e1b5360e82f459daf83649367479da2aefe2503a...8afa5f6777b13a657658ba5000632d0292d626b6
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/20220818/53fbaddd/attachment-0001.htm>
More information about the Pkg-grass-devel
mailing list