Skip to content

Commit 7142bed

Browse files
committed
Fix for CONPY-66:
fixed typo in setup configuration for windows, which caused to link dynamically against MySQL Connector/C.
1 parent eec5fa1 commit 7142bed

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

include/mariadb_python.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ int clock_gettime(int dummy, struct timespec *ct);
7979
#endif /* L64 */
8080
#endif /* _WIN32 */
8181

82+
#define STRINGIFY(n) #n
83+
#define TOSTRING(n) STRINGIFY(n)
84+
85+
#define PY_MARIADB_VERSION TOSTRING(PY_MARIADB_MAJOR_VERSION) "." \
86+
TOSTRING(PY_MARIADB_MINOR_VERSION) "." TOSTRING(PY_MARIADB_PATCH_VERSION)
87+
8288
#define MAX_TPC_XID_SIZE 64
8389
#define POOL_DEFAULT_SIZE 5
8490

mariadb_windows.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ def get_config(options):
5555
cfg.includes = [".\\include", mariadb_dir + "\\include", mariadb_dir + "\\include\\mysql"]
5656
cfg.lib_dirs = [mariadb_dir + "\\lib"]
5757
cfg.libs = ["ws2_32", "advapi32", "kernel32", "shlwapi", "crypt32"]
58-
if static.lower() == "on" or static.lower == "default":
58+
if static.lower() == "on" or static.lower() == "default":
5959
cfg.libs.append("mariadbclient")
6060
else:
61-
cfg.libs.append("libmariadb")
61+
print("dynamic")
6262
cfg.extra_link_args= ["/NODEFAULTLIB:LIBCMT"]
6363
cfg.extra_compile_args=["\"-DDEFAULT_PLUGINS_SUBDIR=\\\"\"" + options["install_dir"].replace(""'\\', '/') + "/lib/plugin\"\\\"\"", "/MD"]
6464
return cfg

setup.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,10 @@
3737
# Since we increase patch version even for alpha/beta/rc, pre release nr will be always zero.
3838
PY_MARIADB_PRE_RELEASE_NR=0
3939

40-
define_macros.append(("PY_MARIADB_VERSION", "\"%s\"" % PY_MARIADB_VERSION))
4140
define_macros.append(("PY_MARIADB_MAJOR_VERSION", PY_MARIADB_MAJOR_VERSION))
4241
define_macros.append(("PY_MARIADB_MINOR_VERSION", PY_MARIADB_MINOR_VERSION))
4342
define_macros.append(("PY_MARIADB_PATCH_VERSION", PY_MARIADB_PATCH_VERSION))
44-
define_macros.append(("PY_MARIADB_PRE_RELEASE_SEGMENT", "\"%s\"" % PY_MARIADB_PRE_RELEASE_SEGMENT))
45-
define_macros.append(("PY_MARIADB_AUTHORS", "\"%s\"" % PY_MARIADB_AUTHORS))
43+
define_macros.append(("PY_MARIADB_PRE_RELEASE_SEGMENT", PY_MARIADB_PRE_RELEASE_SEGMENT))
4644

4745
setup(name='mariadb',
4846
version=PY_MARIADB_VERSION,

src/mariadb.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ PyMODINIT_FUNC PyInit_mariadb(void)
143143
PyObject *version_info;
144144
struct st_constants *intvals= int_constants;
145145

146+
printf("loading mariadb\n");
147+
146148
Py_TYPE(&MrdbConnection_Type) = &PyType_Type;
147149
if (PyType_Ready(&MrdbConnection_Type) == -1)
148150
{
@@ -207,19 +209,14 @@ PyMODINIT_FUNC PyInit_mariadb(void)
207209
if (PyTuple_SetItem(version_info, 0, PyLong_FromLong(PY_MARIADB_MAJOR_VERSION)) ||
208210
PyTuple_SetItem(version_info, 1, PyLong_FromLong(PY_MARIADB_MINOR_VERSION)) ||
209211
PyTuple_SetItem(version_info, 2, PyLong_FromLong(PY_MARIADB_PATCH_VERSION)) ||
210-
PyTuple_SetItem(version_info, 3, PyUnicode_FromString(PY_MARIADB_PRE_RELEASE_SEGMENT)) ||
212+
PyTuple_SetItem(version_info, 3, PyUnicode_FromString(TOSTRING(PY_MARIADB_PRE_RELEASE_SEGMENT))) ||
211213
PyTuple_SetItem(version_info, 4, PyLong_FromLong(0L)))
212214
{
213215
goto error;
214216
}
215217

216218
PyModule_AddObject(module, "__version_info__", version_info);
217219

218-
219-
220-
PyModule_AddObject(module, "__author__",
221-
PyUnicode_FromString(PY_MARIADB_AUTHORS));
222-
223220
/* PEP-249: mandatory module globals */
224221
PyModule_AddObject(module, "apilevel",
225222
PyUnicode_FromString(MARIADB_PY_APILEVEL));

0 commit comments

Comments
 (0)