From e4233595b61dbb4ecea21a88280fba3719d6c5fa Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Wed, 9 Jul 2008 02:45:54 +0200 Subject: [PATCH] Compare VERSION between script and library Detects cases when the script accidentally import the library from the wrong sys.path. Strictly speaking, this should not be necessary if all installations are done correctly, but you never know what might happen. --- germanium/Makefile.am | 3 ++- germanium/germanium.py | 4 ++++ 2 files changed, 6 insertions(+), 1 deletions(-) diff --git a/germanium/Makefile.am b/germanium/Makefile.am index c385ae6..c26ceef 100644 --- a/germanium/Makefile.am +++ b/germanium/Makefile.am @@ -1,6 +1,7 @@ pkgpythondir = $(pythondir)/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION) germanium: germanium.py - sed -e "s|[@]pkgpythondir@|$(pkgpythondir)|" $< > $@ + sed -e "s|[@]pkgpythondir@|$(pkgpythondir)|" \ + -e 's|[@]VERSION@|$(VERSION)|' $< > $@ chmod +x $@ bin_SCRIPTS = germanium diff --git a/germanium/germanium.py b/germanium/germanium.py index 72f141e..0259413 100755 --- a/germanium/germanium.py +++ b/germanium/germanium.py @@ -57,6 +57,10 @@ from urlparse import urlparse import weakref import defs +bin_version = "@VERSION@" +if defs.VERSION != bin_version: + raise Exception("Script and library versions do not match: %s != %s" % (repr(bin_version), repr(defs.VERSION))) + from emp import get_tracks from progress import ProgressDownloader, format_time from gconf_util import gconf_property, bind_file_chooser, bind_combo_box, bind_checkbox -- 1.5.5.1