Skip to content

Commit

Permalink
More portable way of passing the module's version as a C define
Browse files Browse the repository at this point in the history
  • Loading branch information
lelit committed Aug 16, 2017
1 parent fe9ffeb commit 7391377
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions rapidjson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2532,12 +2532,12 @@ PyInit_rapidjson()
PyModule_AddIntConstant(m, "PM_COMMENTS", PM_COMMENTS);
PyModule_AddIntConstant(m, "PM_TRAILING_COMMAS", PM_TRAILING_COMMAS);

PyModule_AddStringConstant(m, "__version__",
PYTHON_RAPIDJSON_VERSION);
PyModule_AddStringConstant(m, "__author__",
"Ken Robbins <ken@kenrobbins.com>");
PyModule_AddStringConstant(m, "__rapidjson_version__",
RAPIDJSON_VERSION_STRING);
#define STRINGIFY(x) XSTRINGIFY(x)
#define XSTRINGIFY(x) #x

PyModule_AddStringConstant(m, "__version__", STRINGIFY(PYTHON_RAPIDJSON_VERSION));
PyModule_AddStringConstant(m, "__author__", "Ken Robbins <ken@kenrobbins.com>");
PyModule_AddStringConstant(m, "__rapidjson_version__", RAPIDJSON_VERSION_STRING);

Py_INCREF(&Decoder_Type);
PyModule_AddObject(m, "Decoder", (PyObject*) &Decoder_Type);
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
extension_options = {
'sources': ['./rapidjson.cpp'],
'include_dirs': [rj_include_dir],
'define_macros': [('PYTHON_RAPIDJSON_VERSION', '"%s"' % VERSION)],
'define_macros': [('PYTHON_RAPIDJSON_VERSION', VERSION)],
}

cc = sysconfig.get_config_var('CC')
Expand Down

0 comments on commit 7391377

Please sign in to comment.