Rename python module version symbol to __version__, add __version_info__
authorPanu Matilainen <pmatilai@redhat.com>
Tue, 4 May 2010 06:05:23 +0000 (09:05 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Tue, 4 May 2010 06:05:23 +0000 (09:05 +0300)
- This seems to be a de-facto standard in python land, as rpm.version
  hasn't been in any released version we can still change this easily.
  Suggestion from James Antill.

python/rpm/__init__.py
python/rpmmodule.c

index b7021ce..d584a39 100644 (file)
@@ -14,6 +14,9 @@ _RPMVSF_NOHEADER = _rpm._RPMVSF_NOHEADER
 _RPMVSF_NOPAYLOAD = _rpm._RPMVSF_NOPAYLOAD
 _RPMVSF_NOSIGNATURES = _rpm._RPMVSF_NOSIGNATURES
 
+__version__ = _rpm.__version__
+__version_info__ = tuple(__version__.split('.'))
+
 # try to import build bits but dont require it
 try:
     from rpm._rpmb import *
index f264efd..78340a9 100644 (file)
@@ -320,7 +320,7 @@ static int initModule(PyObject *m)
 
     addRpmTags(m);
 
-    PyModule_AddStringConstant(m, "version", RPMVERSION);
+    PyModule_AddStringConstant(m, "__version__", RPMVERSION);
 
 #define REGISTER_ENUM(val) PyModule_AddIntConstant(m, #val, val)