Skip to content

Commit 4fb79de

Browse files
committed
Fix for limiting the Python Protobuf to 3.x and set the minimum
requirement to 3.11.0
1 parent dbb4345 commit 4fb79de

File tree

5 files changed

+14
-29
lines changed

5 files changed

+14
-29
lines changed

cpydist/data/deb/rules

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -134,31 +134,12 @@ override_dh_installdocs:
134134
# the Python 3 default install this is provided by "python3-distutils".
135135
# Debian 9 and Ubuntu 16 lacks "python3-distutils" but has "sysconfig"
136136
# anyway.
137-
138-
ifeq ($(shell lsb_release --short --codename),stretch)
139-
SUBSTVARS = -Vpython3-distutils:Depends=
140-
else ifeq ($(shell lsb_release --short --codename),xenial)
141-
SUBSTVARS = -Vpython3-distutils:Depends=
142-
else
143-
SUBSTVARS = -Vpython3-distutils:Depends="python3-distutils"
144-
endif
137+
SUBSTVARS = -Vpython3-distutils:Depends="python3-distutils"
145138

146139
# Python PROTOBUF is required to communicate with the server using a pure
147-
# Python implementation of the protocol. Ubuntu 16.04 lacks a recent enough Python
148-
# protobuf module and then can't communicate using pure Python. But if installing
149-
# the C extension Deb it can be used for the communication instead. At least
150-
# if using the default settings to use the binary driver.
151-
#
152-
# So on Ubuntu 16.04 instead letting the pure Python Deb depend on Python protobuf,
153-
# we let it depend on the C extension Deb. Making it a cross dependency that APT
154-
# can sort out. If installing using "dpkg" you need to force install or install
155-
# both Debs at the same time.
156-
157-
ifeq ($(shell lsb_release --short --codename),xenial)
158-
SUBSTVARS += -Vpython3-protobuf:Depends='mysql-connector-python$(LIC_EXT)-py3 (= $${binary:Version})'
159-
else
160-
SUBSTVARS += -Vpython3-protobuf:Depends='python3-protobuf (>= 3.0.0)'
161-
endif
140+
# Note that at this time, using PROTOBUF 4 is not supported
141+
SUBSTVARS += -Vpython3-protobuf:Depends='python3-protobuf (>= 3.11.0)'
142+
SUBSTVARS += -Vpython3-protobuf:Depends='python3-protobuf (<< 4)'
162143

163144
override_dh_gencontrol:
164145
dh_gencontrol -- $(SUBSTVARS)

cpydist/data/rpm/mysql-connector-python.spec

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
# along with this program; if not, write to the Free Software Foundation, Inc.,
2727
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2828

29-
%global requires_py_protobuf_version 3.0.0
29+
%global requires_py_protobuf_version 3.11.0
3030
%global wants_py_dnspython_version 1.16.0
3131

3232
%undefine _package_note_file
@@ -175,12 +175,16 @@ Requires: python38
175175
# Some operations requires DNSPYTHON but this is not a strict
176176
# requirement for the RPM install as currently few RPM platforms has
177177
# the required version as RPMs. Users need to install using PIP.
178-
# Most of the linux distros except fedora got older version of python3-protobuf.
179178
%if 0%{?fedora}
180179
Requires: python3-dns >= %{wants_py_dnspython_version}
181-
Requires: python3-protobuf >= %{requires_py_protobuf_version}
182180
%endif
183181

182+
# We have no python3-protobuf on EL7, too old versions on EL8 and openSUSE 15
183+
%if 0%{?fedora} || 0%{?rhel} >= 9
184+
Requires: python3-protobuf >= %{requires_py_protobuf_version}, python3-protobuf < 4
185+
%endif
186+
187+
184188
%description -n mysql-connector-python3%{?product_suffix}
185189
MySQL Connector/Python enables Python programs to access MySQL
186190
databases, using an API that is compliant with the Python DB API

docs/mysqlx/requirements.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Requirements
44
* MySQL 8.0.0 or higher, with the X Plugin enabled
55
* Python >= 3.7
66
* Protobuf C++ (version >= 3.0.0)
7-
* Python Protobuf (version >= 3.0.0)
7+
* Python Protobuf (version >= 3.11.0)
88
* dnspython (version >= 1.16.0) for DNS SRV support
99
* lz4 (version >= 2.1.6) for connection compression support
1010
* zstandard (version >= 0.12.0) for connection compression support

lib/mysqlx/protobuf/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ def parse_server_message(msg_type, payload):
347347
except (ImportError, SyntaxError, TypeError) as err:
348348
HAVE_PROTOBUF = False
349349
HAVE_PROTOBUF_ERROR = (
350-
err if PROTOBUF_VERSION is not None else "Protobuf >=3.0.0 is required"
350+
err if PROTOBUF_VERSION is not None else "Protobuf >=3.11.0 is required"
351351
)
352352
if not HAVE_MYSQLXPB_CEXT:
353353
raise ImportError(f"Protobuf is not available: {HAVE_PROTOBUF_ERROR}") from err

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138
],
139139
ext_modules=EXTENSIONS,
140140
cmdclass=COMMAND_CLASSES,
141-
install_requires=["protobuf>=3.0.0"],
141+
install_requires=["protobuf>=3.11.0,<=3.20.1"],
142142
extras_require={
143143
"dns-srv": ["dnspython>=1.16.0"],
144144
"compression": ["lz4>=2.1.6", "zstandard>=0.12.0"],

0 commit comments

Comments
 (0)