The python module provides the version_string() function that returns
the API version but the standard way to do this according to PEP 396
is by providing the __version__ attribute at the module level.
Add __version__ constant to gpiod module and mark version_string() as
deprecated in the doc.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
PyDoc_STRVAR(gpiod_Module_version_string_doc,
"version_string() -> string\n"
"\n"
+"DEPRECATED: use __version__ module attribute instead.\n"
"Get the API version of the library as a human-readable string.");
static PyObject *gpiod_Module_version_string(PyObject *Py_UNUSED(ignored0),
return NULL;
}
+ rv = PyModule_AddStringConstant(module, "__version__",
+ gpiod_version_string());
+ if (rv < 0)
+ return NULL;
+
return module;
}