Skip to content

Commit 3275616

Browse files
committed
WL#15156: Add support for Python 3.11
1 parent 9ab8812 commit 3275616

File tree

9 files changed

+395
-8
lines changed

9 files changed

+395
-8
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Full release notes:
1111
v8.0.31
1212
=======
1313

14+
- WL#15156: Add support for Python 3.11
1415
- BUG#34373612: Fix the assumption that gcc is the default compiler
1516
- BUG#34283402: Binary data starting with 0x00 are returned as empty string
1617
- BUG#34217492: Exec of stored procedures with args fails when db prefix used

cpydist/data/msi/PY311.wxs

Lines changed: 290 additions & 0 deletions
Large diffs are not rendered by default.

cpydist/data/msi/product.wxs

Lines changed: 95 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@
1818
<Property Id="PREVIOUSVERSIONSINSTALLED38" Secure="yes" />
1919
<Property Id="PREVIOUSVERSIONSINSTALLED39" Secure="yes" />
2020
<Property Id="PREVIOUSVERSIONSINSTALLED310" Secure="yes" />
21+
<Property Id="PREVIOUSVERSIONSINSTALLED311" Secure="yes" />
2122

22-
<Upgrade Id="c4142c28-7de9-11e7-b269-5ce0c50b9cbc">
23+
<Upgrade Id="c4142c28-7de9-11e7-b269-5ce0c50b9cbc">
2324
<UpgradeVersion OnlyDetect="no" IncludeMinimum="yes" IncludeMaximum="yes"
2425
Minimum="1.0.0"
2526
Maximum="$(var.Major_Version).$(var.Minor_Version).$(var.Patch_Version)"
@@ -31,13 +32,13 @@
3132
Maximum="$(var.Major_Version).$(var.Minor_Version).$(var.Patch_Version)"
3233
Property="PREVIOUSVERSIONSINSTALLED37"/>
3334
</Upgrade>
34-
<Upgrade Id="29739579-22ec-4df7-905f-05ca0d778c41">
35+
<Upgrade Id="29739579-22ec-4df7-905f-05ca0d778c41">
3536
<UpgradeVersion OnlyDetect="no" IncludeMinimum="yes" IncludeMaximum="yes"
3637
Minimum="1.0.0"
3738
Maximum="$(var.Major_Version).$(var.Minor_Version).$(var.Patch_Version)"
3839
Property="PREVIOUSVERSIONSINSTALLED38"/>
3940
</Upgrade>
40-
<Upgrade Id="180e8431-7c58-4b72-b206-c6d7bd5487d6">
41+
<Upgrade Id="180e8431-7c58-4b72-b206-c6d7bd5487d6">
4142
<UpgradeVersion OnlyDetect="no" IncludeMinimum="yes" IncludeMaximum="yes"
4243
Minimum="1.0.0"
4344
Maximum="$(var.Major_Version).$(var.Minor_Version).$(var.Patch_Version)"
@@ -49,6 +50,12 @@
4950
Maximum="$(var.Major_Version).$(var.Minor_Version).$(var.Patch_Version)"
5051
Property="PREVIOUSVERSIONSINSTALLED310"/>
5152
</Upgrade>
53+
<Upgrade Id="9b50203f-fa8d-4397-b8a4-391b1b89072a">
54+
<UpgradeVersion OnlyDetect="no" IncludeMinimum="yes" IncludeMaximum="yes"
55+
Minimum="1.0.0"
56+
Maximum="$(var.Major_Version).$(var.Minor_Version).$(var.Patch_Version)"
57+
Property="PREVIOUSVERSIONSINSTALLED311"/>
58+
</Upgrade>
5259

5360
<!-- Obtain location of the Python interpreters installed on the system-->
5461

@@ -140,6 +147,28 @@
140147
<?endif?>
141148
</Property>
142149

150+
<!-- Python 3.11 -->
151+
<Property Id="PYTHON311INSTALLPATH_ALL">
152+
<?if "$(var.Platform)"="x64" ?>
153+
<RegistrySearch Id="Python311InstallPathAll64" Root="HKLM" Type="raw"
154+
Key="Software\Python\PythonCore\3.11\InstallPath" Win64="yes"/>
155+
<?else?>
156+
<!-- Starting from python 3.5, 32bit Python install has a '-32' in its InstallPath reg key path -->
157+
<RegistrySearch Id="Python311InstallPathAll32" Root="HKLM" Type="raw"
158+
Key="Software\Python\PythonCore\3.11-32\InstallPath" Win64="no"/>
159+
<?endif?>
160+
</Property>
161+
<Property Id="PYTHON311INSTALLPATH_CURRENT">
162+
<?if "$(var.Platform)"="x64" ?>
163+
<RegistrySearch Id="Python311InstallPathCurrent64" Root="HKCU" Type="raw"
164+
Key="Software\Python\PythonCore\3.11\InstallPath" Win64="yes"/>
165+
<?else?>
166+
<!-- Starting from python 3.5, 32bit Python install has a '-32' in its InstallPath reg key path -->
167+
<RegistrySearch Id="Python311InstallPathCurrent32" Root="HKCU" Type="raw"
168+
Key="Software\Python\PythonCore\3.11-32\InstallPath" Win64="no"/>
169+
<?endif?>
170+
</Property>
171+
143172
<Condition Message="We are unable to locate any supported Python version like Python v$(var.PythonVersion) $(var.Platform) edition. We only support Python installed using the Microsoft Windows Installer (MSI or EXE) downloaded from http://www.python.org/download/. Please check the Connector/Python manual on http://dev.mysql.com/doc/ for more information.">
144173
Installed OR PYTHON36INSTALLPATH_ALL OR PYTHON36INSTALLPATH_CURRENT OR PYTHON37INSTALLPATH_ALL OR PYTHON37INSTALLPATH_CURRENT OR PYTHON38INSTALLPATH_ALL OR PYTHON38INSTALLPATH_CURRENT OR PYTHON39INSTALLPATH_ALL OR PYTHON39INSTALLPATH_CURRENT OR PYTHON310INSTALLPATH_ALL OR PYTHON310INSTALLPATH_CURRENT
145174
</Condition>
@@ -253,6 +282,32 @@
253282
</Directory>
254283
</Directory>
255284

285+
<Directory Id="INSTALLDIRP311" Name="Python311">
286+
<Directory Id="PythonLibDir311" Name="Lib">
287+
<Directory Id="SitePackagesDir311" Name="site-packages">
288+
<Directory Id="EggInfoDir311" Name="mysql_connector_python-$(var.FullVersion)-py3.11.egg-info"/>
289+
<Directory Id="MySQLXPackageDir311" Name="mysqlx">
290+
<Directory Id="MySQLXPB2Dir311" Name="protobuf"/>
291+
<Directory Id="MySQLXLocalesDir311" Name="locales">
292+
<Directory Id="MySQLXLocalesEngDir311" Name="eng"/>
293+
</Directory>
294+
</Directory>
295+
<Directory Id="MySQLPackageDir311" Name="mysql">
296+
<Directory Id="VendorDir311" Name="vendor">
297+
<Directory Id="VendorPluginDir311" Name="plugin"/>
298+
</Directory>
299+
<Directory Id="ConnectorPackageDir311" Name="connector">
300+
<Directory Id="ConnectorPluginsDir311" Name="plugins"/>
301+
<Directory Id="DjangoDir311" Name="django"/>
302+
<Directory Id="ConnectorLocalesDir311" Name="locales">
303+
<Directory Id="LocalesEngDir311" Name="eng"/>
304+
</Directory>
305+
</Directory>
306+
</Directory>
307+
</Directory>
308+
</Directory>
309+
</Directory>
310+
256311
<!-- Common files-->
257312
<Directory Id="$(var.Directory_Id)">
258313
<Directory Id="CompanyDir" Name="MySQL">
@@ -425,6 +480,32 @@
425480
<?endif?>
426481
</Feature>
427482
<?endif?>
483+
484+
<!-- Python 3.11 -->
485+
<?if $(var.BDist311) != "" ?>
486+
<Feature Id="Python311" Title="C/py for Python 3.11" Level="1"
487+
ConfigurableDirectory ="INSTALLDIRP311" Absent="allow">
488+
<Condition Level='0'>Not PYTHON311INSTALLPATH_ALL AND Not PYTHON311INSTALLPATH_CURRENT AND Not Installed</Condition>
489+
<ComponentRef Id="EggInfo311"/>
490+
<ComponentRef Id="MySQLPackage311"/>
491+
<?if $(var.HaveCExt311) = 1 ?>
492+
<ComponentRef Id="Vendor311"/>
493+
<ComponentRef Id="VendorPlugin311"/>
494+
<?endif?>
495+
<ComponentRef Id="ConnectorPackage311"/>
496+
<ComponentRef Id="ConnectorPlugins311"/>
497+
<ComponentRef Id="ConnectorLocales311"/>
498+
<ComponentRef Id="LocalesEng311"/>
499+
<ComponentRef Id="DjangoBackend311"/>
500+
<ComponentRef Id="MySQLXPackage311"/>
501+
<ComponentRef Id="MySQLXPackagePB2311"/>
502+
<ComponentRef Id="MySQLXLocales311"/>
503+
<ComponentRef Id="MySQLXLocalesEng311"/>
504+
<?if $(var.HaveCExt311) = 1 ?>
505+
<ComponentRef Id="CExtension311"/>
506+
<?endif?>
507+
</Feature>
508+
<?endif?>
428509
</Feature>
429510

430511
<!-- Python 3.7 -->
@@ -447,6 +528,11 @@
447528
<CustomAction Id="SetInstallDirAllP310" Property="INSTALLDIRP310" Value="[PYTHON310INSTALLPATH_ALL]"/>
448529
<CustomAction Id="ErrDebug310" Error="Installdir: [INSTALLDIRP310]"/>
449530

531+
<!-- Python 3.11 -->
532+
<CustomAction Id="SetInstallDirCurrentP311" Property="INSTALLDIRP311" Value="[PYTHON311INSTALLPATH_CURRENT]"/>
533+
<CustomAction Id="SetInstallDirAllP311" Property="INSTALLDIRP311" Value="[PYTHON311INSTALLPATH_ALL]"/>
534+
<CustomAction Id="ErrDebug311" Error="Installdir: [INSTALLDIRP311]"/>
535+
450536
<UIRef Id="WixUI_CPY"/>
451537
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR"/>
452538
<UIRef Id="WixUI_ErrorProgressText" />
@@ -469,6 +555,9 @@
469555
<!-- Python 3.10 -->
470556
<Custom Action="SetInstallDirCurrentP310" After="AppSearch">NOT Installed AND PYTHON310INSTALLPATH_CURRENT</Custom>
471557
<Custom Action="SetInstallDirAllP310" After="AppSearch">NOT Installed AND PYTHON310INSTALLPATH_ALL</Custom>
558+
<!-- Python 3.11 -->
559+
<Custom Action="SetInstallDirCurrentP311" After="AppSearch">NOT Installed AND PYTHON311INSTALLPATH_CURRENT</Custom>
560+
<Custom Action="SetInstallDirAllP311" After="AppSearch">NOT Installed AND PYTHON311INSTALLPATH_ALL</Custom>
472561
</InstallExecuteSequence>
473562

474563
<InstallUISequence>
@@ -485,6 +574,9 @@
485574
<!-- Python 3.10 -->
486575
<Custom Action="SetInstallDirCurrentP310" After="AppSearch">NOT Installed AND PYTHON310INSTALLPATH_CURRENT</Custom>
487576
<Custom Action="SetInstallDirAllP310" After="AppSearch">NOT Installed AND PYTHON310INSTALLPATH_ALL</Custom>
577+
<!-- Python 3.11 -->
578+
<Custom Action="SetInstallDirCurrentP311" After="AppSearch">NOT Installed AND PYTHON311INSTALLPATH_CURRENT</Custom>
579+
<Custom Action="SetInstallDirAllP311" After="AppSearch">NOT Installed AND PYTHON311INSTALLPATH_ALL</Custom>
488580
</InstallUISequence>
489581
</Product>
490582
</Wix>

cpydist/data/msi/upgrade_codes.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151
"3.7": "212eea22-7fa3-11e8-81b7-37e66f6c3ce1",
5252
"3.8": "17977a6e-9384-4ec8-84e6-37524546e7f7",
5353
"3.9": "180e8431-7c58-4b72-b206-c6d7bd5487d6",
54-
"3.10": "250f2e4a-1b15-46f8-adb7-7880ac35d616"
54+
"3.10": "250f2e4a-1b15-46f8-adb7-7880ac35d616",
55+
"3.11": "9b50203f-fa8d-4397-b8a4-391b1b89072a"
5556
}
5657
}
5758

cpydist/wix.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ def compile(self, wxs=None, out=None, parameters=None):
198198
r"cpydist\data\msi\PY38.wxs",
199199
r"cpydist\data\msi\PY39.wxs",
200200
r"cpydist\data\msi\PY310.wxs",
201+
r"cpydist\data\msi\PY311.wxs",
201202
r"cpydist\data\msi\cpy_msi_gui.wxs",
202203
]
203204
if parameters:
@@ -239,6 +240,7 @@ def link(self, wixobj=None, base_path=None, data_path=None):
239240
r"{}\PY38.wixobj".format(data_path),
240241
r"{}\PY39.wixobj".format(data_path),
241242
r"{}\PY310.wixobj".format(data_path),
243+
r"{}\PY311.wixobj".format(data_path),
242244
]
243245

244246
self._run_tool("light.exe", cmdargs)

lib/mysqlx/connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2224,7 +2224,7 @@ def use_pure(self):
22242224
return Protobuf.use_pure
22252225

22262226
@use_pure.setter
2227-
def use_pure(self, value):
2227+
def use_pure(self, value): # pylint: disable=no-self-use
22282228
if not isinstance(value, bool):
22292229
raise ProgrammingError("'use_pure' option should be True or False")
22302230
Protobuf.set_use_pure(value)

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
"Programming Language :: Python :: 3.8",
132132
"Programming Language :: Python :: 3.9",
133133
"Programming Language :: Python :: 3.10",
134+
"Programming Language :: Python :: 3.11",
134135
"Topic :: Database",
135136
"Topic :: Software Development",
136137
"Topic :: Software Development :: Libraries :: Application Frameworks",
@@ -142,6 +143,6 @@
142143
extras_require={
143144
"dns-srv": ["dnspython>=1.16.0,<=2.1.0"],
144145
"compression": ["lz4>=2.1.6,<=3.1.3", "zstandard>=0.12.0,<=0.15.2"],
145-
"gssapi": ["gssapi>=1.6.9,<=1.7.3"],
146+
"gssapi": ["gssapi>=1.6.9,<=1.8.1"],
146147
},
147148
)

tests/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ def check_method(self, obj, method):
569569
)
570570

571571
def check_args(self, function, supported_arguments):
572-
argspec = inspect.getargspec(function)
572+
argspec = inspect.getfullargspec(function)
573573
function_arguments = dict(zip(argspec[0][1:], argspec[3]))
574574
for argument, default in function_arguments.items():
575575
try:

tests/qa/test_qa_mysqlx_api_transaction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def test_transaction_savepoint_test4(self):
132132
).execute()
133133
self.assertEqual(collection.count(), 2)
134134
sp = self.session.set_savepoint("SavedPoint")
135-
self.assertEquals(sp, "SavedPoint")
135+
self.assertEqual(sp, "SavedPoint")
136136
collection.add(
137137
{"name": "Robb Stark", "age": 25},
138138
{"name": "Brandon Stark", "age": 15},

0 commit comments

Comments
 (0)