From 5811e79361f855d370466c695bd4facf41cbe872 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Wed, 22 Jan 2014 16:21:17 +0100 Subject: [PATCH] print warning if netlib and mitmproxy versions are different. --- mitmdump | 10 ++++++++-- mitmproxy | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/mitmdump b/mitmdump index 2ceb9b306..49d129d6a 100755 --- a/mitmdump +++ b/mitmdump @@ -1,11 +1,17 @@ #!/usr/bin/env python import sys, signal -from libmproxy import proxy, dump, cmdline, version +from libmproxy import proxy, dump, cmdline +import libmproxy.version, netlib.version import argparse if __name__ == '__main__': + # We don't introduce backward-incompatible changes in patch versions. Only consider major and minor version. + if netlib.version.IVERSION[:2] != libmproxy.version.IVERSION[:2]: + print >> sys.stderr, ("warning: You are using mitmdump %s with netlib %s. " + "Most likely, that doesn't work - please upgrade!") % (libmproxy.version.VERSION, + netlib.version.VERSION) parser = argparse.ArgumentParser(usage = "%(prog)s [options] [filter]") - parser.add_argument('--version', action='version', version="mitmdump" + " " + version.VERSION) + parser.add_argument('--version', action='version', version="mitmdump" + " " + libmproxy.version.VERSION) cmdline.common_options(parser) parser.add_argument( "--keepserving", diff --git a/mitmproxy b/mitmproxy index 4a5e8dd4c..7cc9e3f94 100755 --- a/mitmproxy +++ b/mitmproxy @@ -1,12 +1,18 @@ #!/usr/bin/env python import sys, argparse, os -from libmproxy import proxy, console, cmdline, version +from libmproxy import proxy, console, cmdline +import libmproxy.version, netlib.version from libmproxy.console import palettes if __name__ == '__main__': + # We don't introduce backward-incompatible changes in patch versions. Only consider major and minor version. + if netlib.version.IVERSION[:2] != libmproxy.version.IVERSION[:2]: + print >> sys.stderr, ("warning: You are using mitmproxy %s with netlib %s. " + "Most likely, that doesn't work - please upgrade!") % (libmproxy.version.VERSION, + netlib.version.VERSION) parser = argparse.ArgumentParser(usage = "%(prog)s [options]") - parser.add_argument('--version', action='version', version=version.NAMEVERSION) + parser.add_argument('--version', action='version', version=libmproxy.version.NAMEVERSION) cmdline.common_options(parser) parser.add_argument("--debug", dest="debug", default=False, action="store_true") parser.add_argument(