Adds a __version__ attribute to the C module
* Adds a __version__ tuple attribute to the
_watchdog_fsevents module. This may be used by client
code to determine the version of watchdog library in
use as this version number matches the containing
watchdog version.
Signed-off-by: Gora Khargosh <gora.khargosh@gmail.com>
diff --git a/src/_watchdog_fsevents.c b/src/_watchdog_fsevents.c
index 79d72ee..2b4c7d9 100644
--- a/src/_watchdog_fsevents.c
+++ b/src/_watchdog_fsevents.c
@@ -229,6 +229,12 @@
PyModule_AddIntConstant(module,
MODULE_CONSTANT_NAME_POLLOUT,
kCFFileDescriptorWriteCallBack);
+ PyModule_AddObject(module,
+ "__version__",
+ Py_BuildValue("(iii)",
+ WATCHDOG_VERSION_MAJOR,
+ WATCHDOG_VERSION_MINOR,
+ WATCHDOG_VERSION_BUILD));
Watchdog_FSEvents_Init();
}
@@ -251,6 +257,12 @@
PyModule_AddIntConstant(module,
MODULE_CONSTANT_NAME_POLLOUT,
kCFFileDescriptorWriteCallBack);
+ PyModule_AddObject(module,
+ "__version__",
+ Py_BuildValue("(iii)",
+ WATCHDOG_VERSION_MAJOR,
+ WATCHDOG_VERSION_MINOR,
+ WATCHDOG_VERSION_BUILD));
Watchdog_FSEvents_Init();