Skip to content

Commit d35bfa5

Browse files
committed
WL#15630: Remove Python 3.7 support
This worklog removes the support for Python 3.7 in MySQL Connector/Python. Metadata and packaging scripts were changed accordingly. Change-Id: I39ea8ad61831018f0809d5f40c5eead2ac5e8f37
1 parent 21da163 commit d35bfa5

File tree

14 files changed

+29
-486
lines changed

14 files changed

+29
-486
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.1.0
1212
======
1313

14+
- WL#15630: Remove Python 3.7 support
1415
- WL#15591: Improve the network module
1516
- BUG#35212199: Check for identifier quotes in the database name
1617

cpydist/bdist.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2020, 2022, Oracle and/or its affiliates.
1+
# Copyright (c) 2020, 2023, Oracle and/or its affiliates.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License, version 2.0, as
@@ -44,7 +44,7 @@
4444
set_threshold = None
4545

4646
from . import COMMON_USER_OPTIONS, EDITION, LOGGER, VERSION_TEXT, Command
47-
from .utils import add_docs, copy_tree, write_info_bin, write_info_src
47+
from .utils import add_docs, write_info_bin, write_info_src
4848

4949

5050
class DistBinary(Command):
@@ -206,7 +206,7 @@ def run(self):
206206
("docs/INFO_BIN", "INFO_BIN"),
207207
]
208208

209-
copy_tree(self.bdist_dir, self.dist_target, dirs_exist_ok=True)
209+
shutil.copytree(self.bdist_dir, self.dist_target, dirs_exist_ok=True)
210210
Path(self.dist_target).mkdir(parents=True, exist_ok=True)
211211
for src, dst in info_files:
212212
if dst is None:

cpydist/bdist_msi.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2020, 2022, Oracle and/or its affiliates.
1+
# Copyright (c) 2020, 2023, Oracle and/or its affiliates.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License, version 2.0, as
@@ -48,7 +48,6 @@
4848
from .utils import (
4949
ARCH_64BIT,
5050
add_arch_dep_elems,
51-
copy_tree,
5251
get_magic_tag,
5352
get_openssl_libs,
5453
parse_loose_version,
@@ -107,7 +106,7 @@ class DistMSI(BaseCommand):
107106
_connc_lib = None
108107
_dist_path = {}
109108
_fix_txt_files = {}
110-
_supported_versions = ["3.7", "3.8", "3.9", "3.10", "3.11"]
109+
_supported_versions = ["3.8", "3.9", "3.10", "3.11"]
111110
_with_cext = False
112111
_wxs = None
113112

@@ -188,8 +187,10 @@ def _finalize_connector_c(self, connc_loc):
188187
self.log.error("MySQL C API should be a directory")
189188
sys.exit(1)
190189
self.log.info("# Locating OpeenSSL libraries")
191-
copy_tree(os.path.join(connc_loc, "lib"), self._connc_lib, dirs_exist_ok=True)
192-
copy_tree(
190+
shutil.copytree(
191+
os.path.join(connc_loc, "lib"), self._connc_lib, dirs_exist_ok=True
192+
)
193+
shutil.copytree(
193194
os.path.join(connc_loc, "include"), self._connc_include, dirs_exist_ok=True
194195
)
195196

cpydist/data/deb/control

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ Priority: extra
33
Section: python
44
Maintainer: MySQL Release Engineering <[email protected]>
55
Build-Depends:
6-
debhelper (>= 9.0.0), dh-python, python (>= 3.7.0) | python3 (>= 3.7.0) | python3.7 (>= 3.7.0)
6+
debhelper (>= 9.0.0), dh-python, python (>= 3.8.0) | python3 (>= 3.8.0) | python3.8 (>= 3.8.0)
77
Standards-Version: 3.9.8
88
Homepage: http://dev.mysql.com/downloads/connector/python/
9-
X-Python3-Version: >= 3.7
9+
X-Python3-Version: >= 3.8
1010

1111
Package: mysql-connector-python-py3
1212
Architecture: any

cpydist/data/deb/rules

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/make -f
22

33

4-
# Copyright (c) 2014, 2022, Oracle and/or its affiliates.
4+
# Copyright (c) 2014, 2023, Oracle and/or its affiliates.
55
#
66
# This program is free software; you can redistribute it and/or modify
77
# it under the terms of the GNU General Public License, version 2.0, as
@@ -74,11 +74,6 @@ ifneq ($(shell which py3versions 2>/dev/null),)
7474
PYTHON3_SUPPORTED=$(shell py3versions -sv)
7575
endif
7676

77-
# On Ubuntu 18 we want to use Python 3.7 instead of the default 3.6
78-
ifeq ($(shell lsb_release --short --codename),bionic)
79-
PYTHON3_SUPPORTED=3.7
80-
endif
81-
8277
ifneq ($(BYTE_CODE_ONLY),)
8378
BYTE_CODE_ONLY_OPT = --byte-code-only
8479
else

cpydist/data/msi/PY37.wxs

Lines changed: 0 additions & 302 deletions
This file was deleted.

cpydist/data/msi/product.wxs

Lines changed: 2 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -9,78 +9,12 @@
99

1010
<Package Compressed="yes" InstallerVersion="200"
1111
Description="$(var.ProductName) Installer"
12-
Comments="Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved."
12+
Comments="Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved."
1313
InstallScope="perMachine"
1414
Platform="$(var.Platform)"/>
1515

16-
<Property Id="PREVIOUSVERSIONSINSTALLED36" Secure="yes" />
17-
<Property Id="PREVIOUSVERSIONSINSTALLED37" Secure="yes" />
18-
<Property Id="PREVIOUSVERSIONSINSTALLED38" Secure="yes" />
19-
<Property Id="PREVIOUSVERSIONSINSTALLED39" Secure="yes" />
20-
<Property Id="PREVIOUSVERSIONSINSTALLED310" Secure="yes" />
21-
<Property Id="PREVIOUSVERSIONSINSTALLED311" Secure="yes" />
22-
23-
<Upgrade Id="c4142c28-7de9-11e7-b269-5ce0c50b9cbc">
24-
<UpgradeVersion OnlyDetect="no" IncludeMinimum="yes" IncludeMaximum="yes"
25-
Minimum="1.0.0"
26-
Maximum="$(var.Major_Version).$(var.Minor_Version).$(var.Patch_Version)"
27-
Property="PREVIOUSVERSIONSINSTALLED36"/>
28-
</Upgrade>
29-
<Upgrade Id="212eea22-7fa3-11e8-81b7-37e66f6c3ce1">
30-
<UpgradeVersion OnlyDetect="no" IncludeMinimum="yes" IncludeMaximum="yes"
31-
Minimum="1.0.0"
32-
Maximum="$(var.Major_Version).$(var.Minor_Version).$(var.Patch_Version)"
33-
Property="PREVIOUSVERSIONSINSTALLED37"/>
34-
</Upgrade>
35-
<Upgrade Id="29739579-22ec-4df7-905f-05ca0d778c41">
36-
<UpgradeVersion OnlyDetect="no" IncludeMinimum="yes" IncludeMaximum="yes"
37-
Minimum="1.0.0"
38-
Maximum="$(var.Major_Version).$(var.Minor_Version).$(var.Patch_Version)"
39-
Property="PREVIOUSVERSIONSINSTALLED38"/>
40-
</Upgrade>
41-
<Upgrade Id="180e8431-7c58-4b72-b206-c6d7bd5487d6">
42-
<UpgradeVersion OnlyDetect="no" IncludeMinimum="yes" IncludeMaximum="yes"
43-
Minimum="1.0.0"
44-
Maximum="$(var.Major_Version).$(var.Minor_Version).$(var.Patch_Version)"
45-
Property="PREVIOUSVERSIONSINSTALLED39"/>
46-
</Upgrade>
47-
<Upgrade Id="a0b2ca29-5516-4cb1-a076-178068896350">
48-
<UpgradeVersion OnlyDetect="no" IncludeMinimum="yes" IncludeMaximum="yes"
49-
Minimum="1.0.0"
50-
Maximum="$(var.Major_Version).$(var.Minor_Version).$(var.Patch_Version)"
51-
Property="PREVIOUSVERSIONSINSTALLED310"/>
52-
</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>
59-
6016
<!-- Obtain location of the Python interpreters installed on the system-->
6117

62-
<!-- Python 3.7 -->
63-
<Property Id="PYTHON37INSTALLPATH_ALL">
64-
<?if "$(var.Platform)"="x64" ?>
65-
<RegistrySearch Id="Python37InstallPathAll64" Root="HKLM" Type="raw"
66-
Key="Software\Python\PythonCore\3.7\InstallPath" Win64="yes"/>
67-
<?else?>
68-
<!-- Starting from python 3.5, 32bit Python install has a '-32' in its InstallPath reg key path -->
69-
<RegistrySearch Id="Python37InstallPathAll32" Root="HKLM" Type="raw"
70-
Key="Software\Python\PythonCore\3.7-32\InstallPath" Win64="no"/>
71-
<?endif?>
72-
</Property>
73-
<Property Id="PYTHON37INSTALLPATH_CURRENT">
74-
<?if "$(var.Platform)"="x64" ?>
75-
<RegistrySearch Id="Python37InstallPathCurrent64" Root="HKCU" Type="raw"
76-
Key="Software\Python\PythonCore\3.7\InstallPath" Win64="yes"/>
77-
<?else?>
78-
<!-- Starting from python 3.5, 32bit Python install has a '-32' in its InstallPath reg key path -->
79-
<RegistrySearch Id="Python37InstallPathCurrent32" Root="HKCU" Type="raw"
80-
Key="Software\Python\PythonCore\3.7-32\InstallPath" Win64="no"/>
81-
<?endif?>
82-
</Property>
83-
8418
<!-- Python 3.8 -->
8519
<Property Id="PYTHON38INSTALLPATH_ALL">
8620
<?if "$(var.Platform)"="x64" ?>
@@ -170,40 +104,14 @@
170104
</Property>
171105

172106
<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.">
173-
Installed OR PYTHON37INSTALLPATH_ALL OR PYTHON37INSTALLPATH_CURRENT OR PYTHON38INSTALLPATH_ALL OR PYTHON38INSTALLPATH_CURRENT OR PYTHON39INSTALLPATH_ALL OR PYTHON39INSTALLPATH_CURRENT OR PYTHON310INSTALLPATH_ALL OR PYTHON310INSTALLPATH_CURRENT OR PYTHON311INSTALLPATH_ALL OR PYTHON311INSTALLPATH_CURRENT
107+
Installed OR PYTHON38INSTALLPATH_ALL OR PYTHON38INSTALLPATH_CURRENT OR PYTHON39INSTALLPATH_ALL OR PYTHON39INSTALLPATH_CURRENT OR PYTHON310INSTALLPATH_ALL OR PYTHON310INSTALLPATH_CURRENT OR PYTHON311INSTALLPATH_ALL OR PYTHON311INSTALLPATH_CURRENT
174108
</Condition>
175109

176110
<Media Id="1" Cabinet="ConnectorPython_Python.cab" EmbedCab="yes"/>
177111

178112
<!-- Definition of the folders used by the installed files-->
179113
<Directory Id="TARGETDIR" Name="SourceDir">
180114

181-
<Directory Id="INSTALLDIRP37" Name="Python37">
182-
<Directory Id="PythonLibDir37" Name="Lib">
183-
<Directory Id="SitePackagesDir37" Name="site-packages">
184-
<Directory Id="EggInfoDir37" Name="mysql_connector_python-$(var.FullVersion)-py3.7.egg-info"/>
185-
<Directory Id="MySQLXPackageDir37" Name="mysqlx">
186-
<Directory Id="MySQLXPB2Dir37" Name="protobuf"/>
187-
<Directory Id="MySQLXLocalesDir37" Name="locales">
188-
<Directory Id="MySQLXLocalesEngDir37" Name="eng"/>
189-
</Directory>
190-
</Directory>
191-
<Directory Id="MySQLPackageDir37" Name="mysql">
192-
<Directory Id="VendorDir37" Name="vendor">
193-
<Directory Id="VendorPluginDir37" Name="plugin"/>
194-
</Directory>
195-
<Directory Id="ConnectorPackageDir37" Name="connector">
196-
<Directory Id="ConnectorPluginsDir37" Name="plugins"/>
197-
<Directory Id="DjangoDir37" Name="django"/>
198-
<Directory Id="ConnectorLocalesDir37" Name="locales">
199-
<Directory Id="LocalesEngDir37" Name="eng"/>
200-
</Directory>
201-
</Directory>
202-
</Directory>
203-
</Directory>
204-
</Directory>
205-
</Directory>
206-
207115
<Directory Id="INSTALLDIRP38" Name="Python38">
208116
<Directory Id="PythonLibDir38" Name="Lib">
209117
<Directory Id="SitePackagesDir38" Name="site-packages">
@@ -377,32 +285,6 @@
377285
<ComponentRef Id="MyConnPyExamples"/>
378286
</Feature>
379287

380-
<!-- Python 3.7 -->
381-
<?if $(var.BDist37) != "" ?>
382-
<Feature Id="Python37" Title="C/py for Python 3.7" Level="1"
383-
ConfigurableDirectory ="INSTALLDIRP37" Absent="allow">
384-
<Condition Level='0'>Not PYTHON37INSTALLPATH_ALL AND Not PYTHON37INSTALLPATH_CURRENT AND Not Installed</Condition>
385-
<ComponentRef Id="EggInfo37"/>
386-
<ComponentRef Id="MySQLPackage37"/>
387-
<?if $(var.HaveCExt37) = 1 ?>
388-
<ComponentRef Id="Vendor37"/>
389-
<ComponentRef Id="VendorPlugin37"/>
390-
<?endif?>
391-
<ComponentRef Id="ConnectorPackage37"/>
392-
<ComponentRef Id="ConnectorPlugins37"/>
393-
<ComponentRef Id="ConnectorLocales37"/>
394-
<ComponentRef Id="LocalesEng37"/>
395-
<ComponentRef Id="DjangoBackend37"/>
396-
<ComponentRef Id="MySQLXPackage37"/>
397-
<ComponentRef Id="MySQLXPackagePB237"/>
398-
<ComponentRef Id="MySQLXLocales37"/>
399-
<ComponentRef Id="MySQLXLocalesEng37"/>
400-
<?if $(var.HaveCExt37) = 1 ?>
401-
<ComponentRef Id="CExtension37"/>
402-
<?endif?>
403-
</Feature>
404-
<?endif?>
405-
406288
<!-- Python 3.8 -->
407289
<?if $(var.BDist38) != "" ?>
408290
<Feature Id="Python38" Title="C/py for Python 3.8" Level="1"
@@ -508,11 +390,6 @@
508390
<?endif?>
509391
</Feature>
510392

511-
<!-- Python 3.7 -->
512-
<CustomAction Id="SetInstallDirCurrentP37" Property="INSTALLDIRP37" Value="[PYTHON37INSTALLPATH_CURRENT]"/>
513-
<CustomAction Id="SetInstallDirAllP37" Property="INSTALLDIRP37" Value="[PYTHON37INSTALLPATH_ALL]"/>
514-
<CustomAction Id="ErrDebug37" Error="Installdir: [INSTALLDIRP37]"/>
515-
516393
<!-- Python 3.8 -->
517394
<CustomAction Id="SetInstallDirCurrentP38" Property="INSTALLDIRP38" Value="[PYTHON38INSTALLPATH_CURRENT]"/>
518395
<CustomAction Id="SetInstallDirAllP38" Property="INSTALLDIRP38" Value="[PYTHON38INSTALLPATH_ALL]"/>
@@ -543,9 +420,6 @@
543420
<InstallExecuteSequence>
544421
<Custom Action="PreventDowngrading" After="FindRelatedProducts">NEWPRODUCTFOUND</Custom>
545422
<RemoveExistingProducts After="InstallInitialize" />
546-
<!-- Python 3.7 -->
547-
<Custom Action="SetInstallDirCurrentP37" After="AppSearch">NOT Installed AND PYTHON37INSTALLPATH_CURRENT</Custom>
548-
<Custom Action="SetInstallDirAllP37" After="AppSearch">NOT Installed AND PYTHON37INSTALLPATH_ALL</Custom>
549423
<!-- Python 3.8 -->
550424
<Custom Action="SetInstallDirCurrentP38" After="AppSearch">NOT Installed AND PYTHON38INSTALLPATH_CURRENT</Custom>
551425
<Custom Action="SetInstallDirAllP38" After="AppSearch">NOT Installed AND PYTHON38INSTALLPATH_ALL</Custom>
@@ -562,9 +436,6 @@
562436

563437
<InstallUISequence>
564438
<Custom Action="PreventDowngrading" After="FindRelatedProducts">NEWPRODUCTFOUND</Custom>
565-
<!-- Python 3.7 -->
566-
<Custom Action="SetInstallDirCurrentP37" After="AppSearch">NOT Installed AND PYTHON37INSTALLPATH_CURRENT</Custom>
567-
<Custom Action="SetInstallDirAllP37" After="AppSearch">NOT Installed AND PYTHON37INSTALLPATH_ALL</Custom>
568439
<!-- Python 3.8 -->
569440
<Custom Action="SetInstallDirCurrentP38" After="AppSearch">NOT Installed AND PYTHON38INSTALLPATH_CURRENT</Custom>
570441
<Custom Action="SetInstallDirAllP38" After="AppSearch">NOT Installed AND PYTHON38INSTALLPATH_ALL</Custom>

cpydist/sdist.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2020, 2022, Oracle and/or its affiliates.
1+
# Copyright (c) 2020, 2023, Oracle and/or its affiliates.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License, version 2.0, as
@@ -47,7 +47,7 @@
4747
set_threshold = None
4848

4949
from . import COMMON_USER_OPTIONS, EDITION, LOGGER, VERSION
50-
from .utils import copy_tree, create_tree, get_dist_name, write_info_bin, write_info_src
50+
from .utils import create_tree, get_dist_name, write_info_bin, write_info_src
5151

5252

5353
class DistSource(sdist):
@@ -267,11 +267,11 @@ def run(self):
267267
("docs/INFO_BIN", "INFO_BIN"),
268268
]
269269

270-
copy_tree(self.bdist_dir, self.dist_target, dirs_exist_ok=True)
270+
shutil.copytree(self.bdist_dir, self.dist_target, dirs_exist_ok=True)
271271
Path(self.dist_target).mkdir(parents=True, exist_ok=True)
272272

273273
for src, dst in info_files:
274274
shutil.copyfile(src, os.path.join(self.dist_target, dst))
275275

276276
if not self.keep_temp:
277-
remove_tree(self.build_base, dry_run=self.dry_run)
277+
shutil.rmtree(self.build_base, dry_run=self.dry_run)

cpydist/utils.py

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2020, 2022, Oracle and/or its affiliates.
1+
# Copyright (c) 2020, 2023, Oracle and/or its affiliates.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License, version 2.0, as
@@ -691,23 +691,3 @@ def create_tree(base_dir, files):
691691
# Create them
692692
for directory in sorted(directories):
693693
Path(directory).mkdir(parents=True, exist_ok=True)
694-
695-
696-
def copy_tree(src, dst, dirs_exist_ok=False):
697-
"""Recursively copy an entire directory tree rooted at src to a directory dst.
698-
699-
This is a helper function to add the missing `dir_exist_ok` parameter in
700-
`shutil.copytree()` function on Python 3.7. Which basically removes the contents
701-
of the destination directory.
702-
703-
Args:
704-
src (str): Source directory.
705-
dst (str): Destination directory.
706-
dirs_exist_ok (bool): Overwrite destination folder.
707-
"""
708-
if sys.version_info[:3] >= (3, 8, 0):
709-
shutil.copytree(src, dst, dirs_exist_ok=dirs_exist_ok)
710-
else:
711-
if dirs_exist_ok and os.path.exists(dst):
712-
shutil.rmtree(dst)
713-
shutil.copytree(src, dst)

cpydist/wix.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2020, 2022, Oracle and/or its affiliates.
1+
# Copyright (c) 2020, 2023, Oracle and/or its affiliates.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License, version 2.0, as
@@ -194,7 +194,6 @@ def compile(self, wxs=None, out=None, parameters=None):
194194
r"-v",
195195
r"-ext WixUIExtension",
196196
wxs,
197-
r"cpydist\data\msi\PY37.wxs",
198197
r"cpydist\data\msi\PY38.wxs",
199198
r"cpydist\data\msi\PY39.wxs",
200199
r"cpydist\data\msi\PY310.wxs",
@@ -236,7 +235,6 @@ def link(self, wixobj=None, base_path=None, data_path=None):
236235
rf"-out {msi_out}",
237236
rf"{data_path}\cpy_product_desc.wixobj",
238237
rf"{data_path}\cpy_msi_gui.wixobj",
239-
rf"{data_path}\PY37.wixobj",
240238
rf"{data_path}\PY38.wixobj",
241239
rf"{data_path}\PY39.wixobj",
242240
rf"{data_path}\PY310.wixobj",

docs/mysqlx/requirements.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Requirements
22
============
33

44
* MySQL 8.0.0 or higher, with the X Plugin enabled
5-
* Python >= 3.7
5+
* Python >= 3.8
66
* Protobuf C++ (version >= 3.11.0, <= 3.19.6)
77
* Python Protobuf (version >= 3.11.0, <= 3.20.3)
88
* dnspython (version >= 1.16.0, <= 2.3.0) for DNS SRV support

0 commit comments

Comments
 (0)