From 39128f8cf87b3ccc4bf3256f5d73d0817a4be10b Mon Sep 17 00:00:00 2001 From: Bob Lantz Date: Tue, 3 Jul 2012 22:08:33 -0700 Subject: [PATCH] Add VERSION string. --- bin/mn | 12 +++++++----- mininet/net.py | 3 +++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/bin/mn b/bin/mn index c473a77..548a452 100755 --- a/bin/mn +++ b/bin/mn @@ -19,7 +19,7 @@ import time from mininet.clean import cleanup from mininet.cli import CLI from mininet.log import lg, LEVELS, info, warn -from mininet.net import Mininet, MininetWithControlNet +from mininet.net import Mininet, MininetWithControlNet, VERSION from mininet.node import ( Host, CPULimitedHost, Controller, OVSController, NOX, RemoteController, UserSwitch, OVSKernelSwitch, OVSLegacyKernelSwitch ) @@ -87,6 +87,11 @@ def addDictOption( opts, choicesDict, default, name, helpStr=None ): help = helpStr ) +def version( *_args ): + "Print Mininet version and exit" + print "mn (Mininet %s)" % VERSION + exit() + class MininetRunner( object ): "Build, setup, and run Mininet." @@ -179,10 +184,7 @@ class MininetRunner( object ): opts.add_option( '--pin', action='store_true', default=False, help="pin hosts to CPU cores " "(requires --host cfs or --host rt)" ) - def fakeversion( *args ): - "Fake version for help2man" - print "mn (development version)" - opts.add_option( '--version', action='callback', callback=fakeversion ) + opts.add_option( '--version', action='callback', callback=version ) self.options, self.args = opts.parse_args() diff --git a/mininet/net.py b/mininet/net.py index 0774cd6..eb14411 100755 --- a/mininet/net.py +++ b/mininet/net.py @@ -100,6 +100,9 @@ from mininet.util import quietRun, fixLimits, numCores from mininet.util import macColonHex, ipStr, ipParse, netParse, ipAdd from mininet.term import cleanUpScreens, makeTerms +# Mininet version: should be consistent with README and LICENSE +VERSION = "2.0.0d1" + class Mininet( object ): "Network emulation with hosts spawned in network namespaces."