mirror of
https://github.com/mariadb-corporation/mariadb-connector-python.git
synced 2025-07-22 18:26:37 +00:00
Fix for CONPY-226:
Replaced deprecated call to distutils.version.StrictVersion by packaging.version.Version
This commit is contained in:
@ -22,7 +22,7 @@ import socket
|
||||
import mariadb.cursors
|
||||
|
||||
from mariadb.constants import STATUS, TPC_STATE, INFO
|
||||
from distutils.version import StrictVersion
|
||||
from packaging import version
|
||||
|
||||
_DEFAULT_CHARSET = "utf8mb4"
|
||||
_DEFAULT_COLLATION = "utf8mb4_general_ci"
|
||||
@ -68,8 +68,8 @@ class Connection(mariadb._mariadb.connection):
|
||||
# we need to check if it's supported by Connector/C
|
||||
if "host" in kwargs:
|
||||
host = kwargs.get("host")
|
||||
if StrictVersion(mariadb.mariadbapi_version) <\
|
||||
StrictVersion('3.3.0') and ',' in host:
|
||||
if version.Version(mariadb.mariadbapi_version) <\
|
||||
version.Version('3.3.0') and ',' in host:
|
||||
raise mariadb.ProgrammingError("Host failover list requires "
|
||||
"MariaDB Connector/C 3.3.0 "
|
||||
"or newer")
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import subprocess
|
||||
from distutils.version import StrictVersion
|
||||
from packaging import version
|
||||
import sys
|
||||
import os
|
||||
|
||||
@ -60,7 +60,7 @@ def get_config(options):
|
||||
config_prg = "mariadb_config"
|
||||
|
||||
cc_version = mariadb_config(config_prg, "cc_version")
|
||||
if StrictVersion(cc_version[0]) < StrictVersion(required_version):
|
||||
if version.Version(cc_version[0]) < version.Version(required_version):
|
||||
print('MariaDB Connector/Python requires MariaDB Connector/C '
|
||||
'>= %s, found version %s' % (required_version, cc_version[0]))
|
||||
sys.exit(2)
|
||||
|
@ -5,7 +5,7 @@
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
from distutils.version import StrictVersion
|
||||
from packaging import version
|
||||
|
||||
from winreg import ConnectRegistry, OpenKey, QueryValueEx,\
|
||||
HKEY_LOCAL_MACHINE, KEY_READ, KEY_WOW64_64KEY
|
||||
@ -45,8 +45,8 @@ def get_config(options):
|
||||
'MariaDB Connector C 64-bit',
|
||||
access=KEY_READ | KEY_WOW64_64KEY)
|
||||
cc_version = QueryValueEx(connector_key, "Version")
|
||||
if (StrictVersion(cc_version[0]) <
|
||||
StrictVersion(required_version)):
|
||||
if (version.Version(cc_version[0]) <
|
||||
version.Version(required_version)):
|
||||
print("MariaDB Connector/Python requires "
|
||||
"MariaDB Connector/C "
|
||||
">= %s (found version: %s") \
|
||||
|
Reference in New Issue
Block a user