Skip to content

Commit

Permalink
Fix for CONPY-66:
Browse files Browse the repository at this point in the history
fixed typo in setup configuration for windows, which caused to link
dynamically against MySQL Connector/C.
  • Loading branch information
9EOR9 committed May 14, 2020
1 parent eec5fa1 commit 7142bed
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
6 changes: 6 additions & 0 deletions include/mariadb_python.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ int clock_gettime(int dummy, struct timespec *ct);
#endif /* L64 */
#endif /* _WIN32 */

#define STRINGIFY(n) #n
#define TOSTRING(n) STRINGIFY(n)

#define PY_MARIADB_VERSION TOSTRING(PY_MARIADB_MAJOR_VERSION) "." \
TOSTRING(PY_MARIADB_MINOR_VERSION) "." TOSTRING(PY_MARIADB_PATCH_VERSION)

#define MAX_TPC_XID_SIZE 64
#define POOL_DEFAULT_SIZE 5

Expand Down
4 changes: 2 additions & 2 deletions mariadb_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ def get_config(options):
cfg.includes = [".\\include", mariadb_dir + "\\include", mariadb_dir + "\\include\\mysql"]
cfg.lib_dirs = [mariadb_dir + "\\lib"]
cfg.libs = ["ws2_32", "advapi32", "kernel32", "shlwapi", "crypt32"]
if static.lower() == "on" or static.lower == "default":
if static.lower() == "on" or static.lower() == "default":
cfg.libs.append("mariadbclient")
else:
cfg.libs.append("libmariadb")
print("dynamic")
cfg.extra_link_args= ["/NODEFAULTLIB:LIBCMT"]
cfg.extra_compile_args=["\"-DDEFAULT_PLUGINS_SUBDIR=\\\"\"" + options["install_dir"].replace(""'\\', '/') + "/lib/plugin\"\\\"\"", "/MD"]
return cfg
4 changes: 1 addition & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,10 @@
# Since we increase patch version even for alpha/beta/rc, pre release nr will be always zero.
PY_MARIADB_PRE_RELEASE_NR=0

define_macros.append(("PY_MARIADB_VERSION", "\"%s\"" % PY_MARIADB_VERSION))
define_macros.append(("PY_MARIADB_MAJOR_VERSION", PY_MARIADB_MAJOR_VERSION))
define_macros.append(("PY_MARIADB_MINOR_VERSION", PY_MARIADB_MINOR_VERSION))
define_macros.append(("PY_MARIADB_PATCH_VERSION", PY_MARIADB_PATCH_VERSION))
define_macros.append(("PY_MARIADB_PRE_RELEASE_SEGMENT", "\"%s\"" % PY_MARIADB_PRE_RELEASE_SEGMENT))
define_macros.append(("PY_MARIADB_AUTHORS", "\"%s\"" % PY_MARIADB_AUTHORS))
define_macros.append(("PY_MARIADB_PRE_RELEASE_SEGMENT", PY_MARIADB_PRE_RELEASE_SEGMENT))

setup(name='mariadb',
version=PY_MARIADB_VERSION,
Expand Down
9 changes: 3 additions & 6 deletions src/mariadb.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ PyMODINIT_FUNC PyInit_mariadb(void)
PyObject *version_info;
struct st_constants *intvals= int_constants;

printf("loading mariadb\n");

Py_TYPE(&MrdbConnection_Type) = &PyType_Type;
if (PyType_Ready(&MrdbConnection_Type) == -1)
{
Expand Down Expand Up @@ -207,19 +209,14 @@ PyMODINIT_FUNC PyInit_mariadb(void)
if (PyTuple_SetItem(version_info, 0, PyLong_FromLong(PY_MARIADB_MAJOR_VERSION)) ||
PyTuple_SetItem(version_info, 1, PyLong_FromLong(PY_MARIADB_MINOR_VERSION)) ||
PyTuple_SetItem(version_info, 2, PyLong_FromLong(PY_MARIADB_PATCH_VERSION)) ||
PyTuple_SetItem(version_info, 3, PyUnicode_FromString(PY_MARIADB_PRE_RELEASE_SEGMENT)) ||
PyTuple_SetItem(version_info, 3, PyUnicode_FromString(TOSTRING(PY_MARIADB_PRE_RELEASE_SEGMENT))) ||
PyTuple_SetItem(version_info, 4, PyLong_FromLong(0L)))
{
goto error;
}

PyModule_AddObject(module, "__version_info__", version_info);



PyModule_AddObject(module, "__author__",
PyUnicode_FromString(PY_MARIADB_AUTHORS));

/* PEP-249: mandatory module globals */
PyModule_AddObject(module, "apilevel",
PyUnicode_FromString(MARIADB_PY_APILEVEL));
Expand Down

0 comments on commit 7142bed

Please sign in to comment.