-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP][CORE UPDATE - PART X] Protobuf_cpp fixes and updated version (#…
…1551) * Update protobuf_cpp recipe and grant python3 compatibility The removed flags are already set in base class, so no need to set in here. * Move libraries from LDFLAGS to LIBS for protobuf_cpp recipe Because this is how you are supposed to do it, you must use LDFLAGS for linker flags and LDLIBS (or the equivalent LOADLIBES) for the libraries
- Loading branch information
1 parent
ddb46f6
commit bf214b3
Showing
2 changed files
with
109 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
pythonforandroid/recipes/protobuf_cpp/fix-python3-compatibility.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
From 539bc017a62f91bdf7c547b58948cb5a2f59d918 Mon Sep 17 00:00:00 2001 | ||
From: Ben Webb <[email protected]> | ||
Date: Thu, 12 Jul 2018 10:58:10 -0700 | ||
Subject: [PATCH] Add Python 3.7 compatibility (#4862) | ||
|
||
Compilation of Python wrappers fails with Python 3.7 because | ||
the Python folks changed their C API such that | ||
PyUnicode_AsUTF8AndSize() now returns a const char* rather | ||
than a char*. Add a patch to work around. Relates #4086. | ||
--- | ||
python/google/protobuf/pyext/descriptor.cc | 2 +- | ||
python/google/protobuf/pyext/descriptor_containers.cc | 2 +- | ||
python/google/protobuf/pyext/descriptor_pool.cc | 2 +- | ||
python/google/protobuf/pyext/extension_dict.cc | 2 +- | ||
python/google/protobuf/pyext/message.cc | 4 ++-- | ||
5 files changed, 6 insertions(+), 6 deletions(-) | ||
|
||
diff --git a/python/google/protobuf/pyext/descriptor.cc b/python/google/protobuf/pyext/descriptor.cc | ||
index 8af0cb1289..19a1c38a62 100644 | ||
--- a/python/google/protobuf/pyext/descriptor.cc | ||
+++ b/python/google/protobuf/pyext/descriptor.cc | ||
@@ -56,7 +56,7 @@ | ||
#endif | ||
#define PyString_AsStringAndSize(ob, charpp, sizep) \ | ||
(PyUnicode_Check(ob)? \ | ||
- ((*(charpp) = PyUnicode_AsUTF8AndSize(ob, (sizep))) == NULL? -1: 0): \ | ||
+ ((*(charpp) = const_cast<char*>(PyUnicode_AsUTF8AndSize(ob, (sizep)))) == NULL? -1: 0): \ | ||
PyBytes_AsStringAndSize(ob, (charpp), (sizep))) | ||
#endif | ||
|
||
diff --git a/python/google/protobuf/pyext/descriptor_containers.cc b/python/google/protobuf/pyext/descriptor_containers.cc | ||
index bc007f7efa..0153664f50 100644 | ||
--- a/python/google/protobuf/pyext/descriptor_containers.cc | ||
+++ b/python/google/protobuf/pyext/descriptor_containers.cc | ||
@@ -66,7 +66,7 @@ | ||
#endif | ||
#define PyString_AsStringAndSize(ob, charpp, sizep) \ | ||
(PyUnicode_Check(ob)? \ | ||
- ((*(charpp) = PyUnicode_AsUTF8AndSize(ob, (sizep))) == NULL? -1: 0): \ | ||
+ ((*(charpp) = const_cast<char*>(PyUnicode_AsUTF8AndSize(ob, (sizep)))) == NULL? -1: 0): \ | ||
PyBytes_AsStringAndSize(ob, (charpp), (sizep))) | ||
#endif | ||
|
||
diff --git a/python/google/protobuf/pyext/descriptor_pool.cc b/python/google/protobuf/pyext/descriptor_pool.cc | ||
index 95882aeb35..962accc6e9 100644 | ||
--- a/python/google/protobuf/pyext/descriptor_pool.cc | ||
+++ b/python/google/protobuf/pyext/descriptor_pool.cc | ||
@@ -48,7 +48,7 @@ | ||
#endif | ||
#define PyString_AsStringAndSize(ob, charpp, sizep) \ | ||
(PyUnicode_Check(ob)? \ | ||
- ((*(charpp) = PyUnicode_AsUTF8AndSize(ob, (sizep))) == NULL? -1: 0): \ | ||
+ ((*(charpp) = const_cast<char*>(PyUnicode_AsUTF8AndSize(ob, (sizep)))) == NULL? -1: 0): \ | ||
PyBytes_AsStringAndSize(ob, (charpp), (sizep))) | ||
#endif | ||
|
||
diff --git a/python/google/protobuf/pyext/extension_dict.cc b/python/google/protobuf/pyext/extension_dict.cc | ||
index 018b5c2c49..174c5470c2 100644 | ||
--- a/python/google/protobuf/pyext/extension_dict.cc | ||
+++ b/python/google/protobuf/pyext/extension_dict.cc | ||
@@ -53,7 +53,7 @@ | ||
#endif | ||
#define PyString_AsStringAndSize(ob, charpp, sizep) \ | ||
(PyUnicode_Check(ob)? \ | ||
- ((*(charpp) = PyUnicode_AsUTF8AndSize(ob, (sizep))) == NULL? -1: 0): \ | ||
+ ((*(charpp) = const_cast<char*>(PyUnicode_AsUTF8AndSize(ob, (sizep)))) == NULL? -1: 0): \ | ||
PyBytes_AsStringAndSize(ob, (charpp), (sizep))) | ||
#endif | ||
|
||
diff --git a/python/google/protobuf/pyext/message.cc b/python/google/protobuf/pyext/message.cc | ||
index 5893533adf..31094b7e10 100644 | ||
--- a/python/google/protobuf/pyext/message.cc | ||
+++ b/python/google/protobuf/pyext/message.cc | ||
@@ -79,7 +79,7 @@ | ||
(PyUnicode_Check(ob)? PyUnicode_AsUTF8(ob): PyBytes_AsString(ob)) | ||
#define PyString_AsStringAndSize(ob, charpp, sizep) \ | ||
(PyUnicode_Check(ob)? \ | ||
- ((*(charpp) = PyUnicode_AsUTF8AndSize(ob, (sizep))) == NULL? -1: 0): \ | ||
+ ((*(charpp) = const_cast<char*>(PyUnicode_AsUTF8AndSize(ob, (sizep)))) == NULL? -1: 0): \ | ||
PyBytes_AsStringAndSize(ob, (charpp), (sizep))) | ||
#endif | ||
#endif | ||
@@ -1529,7 +1529,7 @@ PyObject* HasField(CMessage* self, PyObject* arg) { | ||
return NULL; | ||
} | ||
#else | ||
- field_name = PyUnicode_AsUTF8AndSize(arg, &size); | ||
+ field_name = const_cast<char*>(PyUnicode_AsUTF8AndSize(arg, &size)); | ||
if (!field_name) { | ||
return NULL; | ||
} |