
From: ShaoHe Feng <shaohef@linux.vnet.ibm.com> add a method to get kimchi version in config.py If kimchi run after package install, just get the version. Or get the build nubmer. Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com> --- src/kimchi/Makefile.am | 4 +++- src/kimchi/config.py.in | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/kimchi/Makefile.am b/src/kimchi/Makefile.am index e48a6d1..90d931d 100644 --- a/src/kimchi/Makefile.am +++ b/src/kimchi/Makefile.am @@ -41,7 +41,9 @@ do_substitution = \ -e 's,[@]sysconfdir[@],$(sysconfdir),g' \ -e 's,[@]localstatedir[@],$(localstatedir),g' \ -e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \ - -e 's,[@]kimchidir[@],$(kimchidir),g' + -e 's,[@]kimchidir[@],$(kimchidir),g' \ + -e 's,[@]kimchiversion[@],$(PACKAGE_VERSION),g' \ + -e 's,[@]kimchirelease[@],$(PACKAGE_RELEASE),g' inpackage_substitution = sed -i -e 's,[@]inpackage[@],yes,g' diff --git a/src/kimchi/config.py.in b/src/kimchi/config.py.in index 3e84215..8f2fc4e 100644 --- a/src/kimchi/config.py.in +++ b/src/kimchi/config.py.in @@ -30,6 +30,8 @@ from ConfigParser import SafeConfigParser from kimchi.xmlutils import xpath_get_text __inpackage__ = "@inpackage@" +__version__ = "@kimchiversion@" +__release__ = "@kimchirelease@" DEFAULT_LOG_LEVEL = "debug" @@ -55,6 +57,13 @@ def get_debugreports_path(): return os.path.join(paths.state_dir, 'debugreports') +def get_version(): + if __inpackage__ == "yes": + return __version__ + + return "-".join([__version__, __release__]) + + def find_qemu_binary(find_emulator=False): try: connect = libvirt.open('qemu:///system') -- 1.8.5.3