[grass] 02/05: Add patch to fix Python ctypes conversion for stat64 struct on Hurd.
Sebastiaan Couwenberg
sebastic at moszumanska.debian.org
Sun Feb 8 18:14:48 UTC 2015
This is an automated email from the git hooks/post-receive script.
sebastic pushed a commit to branch experimental
in repository grass.
commit 9318410ebc678c6507e9ea7c4e8def2c4fcaf22b
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date: Sun Feb 8 15:30:31 2015 +0100
Add patch to fix Python ctypes conversion for stat64 struct on Hurd.
---
debian/changelog | 1 +
debian/patches/python-ctypes-ternary.patch | 35 ++++++++++++++++++++++++++++++
debian/patches/series | 1 +
3 files changed, 37 insertions(+)
diff --git a/debian/changelog b/debian/changelog
index 5264e5f..6d24844 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,7 @@
grass (7.0.0~rc1+ds1-1~exp2) UNRELEASED; urgency=medium
* Add patch to treat GNU/{Hurd,kFreeBSD} like Linux in SC_CONFIG_CFLAGS.
+ * Add patch to fix Python ctypes conversion for stat64 struct on Hurd.
-- Bas Couwenberg <sebastic at debian.org> Sat, 07 Feb 2015 20:48:47 +0100
diff --git a/debian/patches/python-ctypes-ternary.patch b/debian/patches/python-ctypes-ternary.patch
new file mode 100644
index 0000000..36b90a8
--- /dev/null
+++ b/debian/patches/python-ctypes-ternary.patch
@@ -0,0 +1,35 @@
+Description: Enclose Python ternary in parenthesis.
+ This fixes an issue with the C to Python conversion of the stat & stat64
+ structs on GNU/Hurd. The structs define the final member conditionally:
+ .
+ #define _SPARE_SIZE ((sizeof (__fsid_t) == sizeof (int)) ? 9 : 8)
+ int st_spare[_SPARE_SIZE]; /* Room for future expansion. */
+ #undef _SPARE_SIZE
+ .
+ This gets converted by ctypesgen to:
+ .
+ ('st_spare', c_int * (sizeof(__fsid_t) == sizeof(c_int)) and 9 or 8),
+ .
+ Which causes a TypeError:
+ .
+ TypeError: second item in _fields_ tuple (index 17) must be a C type
+ .
+ Enclosing the Python expression in parenthesis to become:
+ .
+ ('st_spare', c_int * ((sizeof(__fsid_t) == sizeof(c_int)) and 9 or 8)),
+ .
+ fixes the TypeError.
+Author: Bas Couwenberg <sebastic at xs4all.nl>
+Forwarded: https://trac.osgeo.org/grass/ticket/2581
+
+--- a/lib/python/ctypes/ctypesgencore/expressions.py
++++ b/lib/python/ctypes/ctypesgencore/expressions.py
+@@ -208,7 +208,7 @@ class ConditionalExpressionNode(Expressi
+ return self.no.evaluate(context)
+
+ def py_string(self, can_be_ctype):
+- return "%s and %s or %s" % \
++ return "(%s and %s or %s)" % \
+ (self.cond.py_string(True),
+ self.yes.py_string(can_be_ctype),
+ self.no.py_string(can_be_ctype))
diff --git a/debian/patches/series b/debian/patches/series
index ffbb9fe..bbec2d1 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,6 +3,7 @@ pager
instdir
check4dev
sc-config-cflags.patch
+python-ctypes-ternary.patch
wxpy3.0-compat.patch
parameter-typo.patch
additionally-typo.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/grass.git
More information about the Pkg-grass-devel
mailing list