summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2018-02-19 13:54:11 +0000
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2018-02-19 13:54:11 +0000
commit0a5db6ecf5568b976ae67fbedc04c72c4aec92f2 (patch)
tree8a2ddbd87dc43bfbdf2c9d8b033735f2c20c84c2
parent750ececf0850d6a14dc97885c17426915340eed6 (diff)
parentede418a009ea1875be37e5537c4b0c9640fc1685 (diff)
downloadpsycopg2-0a5db6ecf5568b976ae67fbedc04c72c4aec92f2.tar.gz
Merge branch 'expand-version'
-rw-r--r--NEWS3
-rw-r--r--psycopg/psycopgmodule.c8
-rw-r--r--setup.py5
3 files changed, 9 insertions, 7 deletions
diff --git a/NEWS b/NEWS
index dfee39c..d67ab1f 100644
--- a/NEWS
+++ b/NEWS
@@ -18,7 +18,8 @@ What's new in psycopg 2.7.5
^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Fixed building on Solaris 11 and derivatives such as SmartOS and illumos
- (:ticket:`#677`)
+ (:ticket:`#677`).
+- Maybe fixed building on MSYS2 (as reported in :ticket:`#658`).
What's new in psycopg 2.7.4
diff --git a/psycopg/psycopgmodule.c b/psycopg/psycopgmodule.c
index 6c95bd6..5deaa16 100644
--- a/psycopg/psycopgmodule.c
+++ b/psycopg/psycopgmodule.c
@@ -72,6 +72,10 @@ HIDDEN PyObject *psyco_null = NULL;
/* The type of the cursor.description items */
HIDDEN PyObject *psyco_DescriptionType = NULL;
+/* macro trick to stringify a macro expansion */
+#define xstr(s) str(s)
+#define str(s) #s
+
/** connect module-level function **/
#define psyco_connect_doc \
"_connect(dsn, [connection_factory], [async]) -- New database connection.\n\n"
@@ -885,7 +889,7 @@ INIT_MODULE(_psycopg)(void)
psycopg_debug_enabled = 1;
#endif
- Dprintf("initpsycopg: initializing psycopg %s", PSYCOPG_VERSION);
+ Dprintf("initpsycopg: initializing psycopg %s", xstr(PSYCOPG_VERSION));
/* initialize all the new types and then the module */
Py_TYPE(&connectionType) = &PyType_Type;
@@ -1017,7 +1021,7 @@ INIT_MODULE(_psycopg)(void)
if (!(psyco_DescriptionType = psyco_make_description_type())) { goto exit; }
/* set some module's parameters */
- PyModule_AddStringConstant(module, "__version__", PSYCOPG_VERSION);
+ PyModule_AddStringConstant(module, "__version__", xstr(PSYCOPG_VERSION));
PyModule_AddStringConstant(module, "__doc__", "psycopg PostgreSQL driver");
PyModule_AddIntConstant(module, "__libpq_version__", PG_VERSION_NUM);
PyModule_AddIntMacro(module, REPLICATION_PHYSICAL);
diff --git a/setup.py b/setup.py
index ec2b5ae..2d608c8 100644
--- a/setup.py
+++ b/setup.py
@@ -596,10 +596,7 @@ if version_flags:
else:
PSYCOPG_VERSION_EX = PSYCOPG_VERSION
-if not PLATFORM_IS_WINDOWS:
- define_macros.append(('PSYCOPG_VERSION', '"' + PSYCOPG_VERSION_EX + '"'))
-else:
- define_macros.append(('PSYCOPG_VERSION', '\\"' + PSYCOPG_VERSION_EX + '\\"'))
+define_macros.append(('PSYCOPG_VERSION', PSYCOPG_VERSION_EX))
if parser.has_option('build_ext', 'have_ssl'):
have_ssl = int(parser.get('build_ext', 'have_ssl'))