Skip to content

Commit f72a132

Browse files
author
Oscar Pacheco
committed
BUG#36452514: Missing version info resources
Added legal, version and other metadata information for the DLL file implementing the C-extension of the classic connector. Change-Id: I8237b1055b52cb5d46705d397a89ecdad394216f
1 parent ea169ff commit f72a132

File tree

4 files changed

+86
-9
lines changed

4 files changed

+86
-9
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ v9.4.0
1212
======
1313

1414
- BUG#37806057: Rename extra option (when installing wheel package) to install webauthn functionality dependencies
15+
- BUG#36452514: Missing version info resources
1516
- BUG#34950958: MySQL Python Connector doesn't work with ssh in the same process
1617
- BUG#34844347: Freezes on connection via sshtunnel
1718

automation/headerfy.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
PATTERN_YEARS = r"Copyright\s+\(c\)\s+\d{4},\s*\d{4},\s+Oracle"
9999

100100
TARGET_SRC_PY_EXTS = [".py", ".sh", ".spec", ".postinst", ".postrm", ".toml"]
101-
TARGET_SRC_C_EXTS = [".c", ".h", ".cpp", ".cc", ".proto"]
101+
TARGET_SRC_C_EXTS = [".c", ".h", ".cpp", ".cc", ".proto", ".rc"]
102102
TARGET_SRC_PLAIN_EXTS = [".rst"]
103103

104104
TARGET_SRC_EXTS = TARGET_SRC_PY_EXTS + TARGET_SRC_C_EXTS + TARGET_SRC_PLAIN_EXTS
@@ -178,7 +178,6 @@ def update_header(root: Union[str, Path], filename: str) -> None:
178178
else ""
179179
)
180180

181-
182181
logger.info("%s (%s)", path_to_file, creation_year if creation_year else "NULL")
183182

184183
creation_year = f"{creation_year}, " if creation_year else f"{DEFAULT_FOUND_YEAR}, "

mysql-connector-python/setup.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,22 @@
7575
if DistWheel is not None:
7676
COMMAND_CLASSES["bdist_wheel"] = DistWheel
7777

78+
cext_src_files = [
79+
"src/exceptions.c",
80+
"src/mysql_capi.c",
81+
"src/mysql_capi_conversion.c",
82+
"src/mysql_connector.c",
83+
"src/force_cpp_linkage.cc",
84+
]
85+
86+
if os.name == "nt":
87+
cext_src_files.append("src/version_info.rc")
88+
7889
# C extensions
7990
EXTENSIONS = [
8091
Extension(
8192
"_mysql_connector",
82-
sources=[
83-
"src/exceptions.c",
84-
"src/mysql_capi.c",
85-
"src/mysql_capi_conversion.c",
86-
"src/mysql_connector.c",
87-
"src/force_cpp_linkage.cc",
88-
],
93+
sources=cext_src_files,
8994
include_dirs=["src/include"],
9095
),
9196
]
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/*
2+
* Copyright (c) 2025, Oracle and/or its affiliates.
3+
*
4+
* This program is free software; you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License, version 2.0, as
6+
* published by the Free Software Foundation.
7+
*
8+
* This program is designed to work with certain software (including
9+
* but not limited to OpenSSL) that is licensed under separate terms,
10+
* as designated in a particular file or component or in included license
11+
* documentation. The authors of MySQL hereby grant you an
12+
* additional permission to link the program and your derivative works
13+
* with the separately licensed software that they have either included with
14+
* the program or referenced in the documentation.
15+
*
16+
* Without limiting anything contained in the foregoing, this file,
17+
* which is part of MySQL Connector/Python, is also subject to the
18+
* Universal FOSS Exception, version 1.0, a copy of which can be found at
19+
* http://oss.oracle.com/licenses/universal-foss-exception.
20+
*
21+
* This program is distributed in the hope that it will be useful, but
22+
* WITHOUT ANY WARRANTY; without even the implied warranty of
23+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
24+
* See the GNU General Public License, version 2.0, for more details.
25+
*
26+
* You should have received a copy of the GNU General Public License
27+
* along with this program; if not, write to the Free Software Foundation, Inc.,
28+
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29+
*/
30+
31+
// Version Information
32+
// Reference: https://learn.microsoft.com/en-us/windows/win32/menurc/versioninfo-resource
33+
34+
#include <windows.h>
35+
#include <winver.h>
36+
37+
#define CONPY_VERSION "9.4.0"
38+
#define CONPY_VERSION_RAW 9,4,0,0
39+
40+
// Set up debug information
41+
#if DBG
42+
#define VER_DBG VS_FF_DEBUG
43+
#else
44+
#define VER_DBG 0
45+
#endif
46+
47+
48+
VS_VERSION_INFO VERSIONINFO
49+
FILEVERSION CONPY_VERSION_RAW
50+
PRODUCTVERSION CONPY_VERSION_RAW
51+
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
52+
FILEFLAGS VER_DBG
53+
FILEOS VOS__WINDOWS32
54+
FILETYPE VFT_DLL
55+
BEGIN
56+
BLOCK "StringFileInfo"
57+
BEGIN
58+
BLOCK "040904b0"
59+
BEGIN
60+
VALUE "CompanyName", "Oracle Corporation"
61+
VALUE "ProductName", "MySQL Connector/Python"
62+
VALUE "ProductVersion", CONPY_VERSION
63+
VALUE "FileVersion", CONPY_VERSION
64+
VALUE "LegalCopyright", "Copyright (c) 2016, 2025, Oracle and/or its affiliates."
65+
VALUE "LegalTrademarks", "Oracle(R), Java, MySQL, and NetSuite are registered trademarks of Oracle and/or its affiliates."
66+
VALUE "OriginalFilename", "_mysql_connector.pyd"
67+
VALUE "InternalName", "_mysql_connector.pyd"
68+
VALUE "FileDescription", "MySQL driver written in Python which depends on MySQL C client libraries and implements the DB API v2.0 specification (PEP-249)."
69+
VALUE "Comments", "C extension of MySQL Connector/Python."
70+
END
71+
END
72+
END

0 commit comments

Comments
 (0)