Add VERSION string.

This commit is contained in:
Bob Lantz
2012-07-03 22:08:33 -07:00
parent 7fe847967d
commit 39128f8cf8
2 changed files with 10 additions and 5 deletions
+7 -5
View File
@@ -19,7 +19,7 @@ import time
from mininet.clean import cleanup from mininet.clean import cleanup
from mininet.cli import CLI from mininet.cli import CLI
from mininet.log import lg, LEVELS, info, warn 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, from mininet.node import ( Host, CPULimitedHost, Controller, OVSController,
NOX, RemoteController, UserSwitch, OVSKernelSwitch, NOX, RemoteController, UserSwitch, OVSKernelSwitch,
OVSLegacyKernelSwitch ) OVSLegacyKernelSwitch )
@@ -87,6 +87,11 @@ def addDictOption( opts, choicesDict, default, name, helpStr=None ):
help = helpStr ) help = helpStr )
def version( *_args ):
"Print Mininet version and exit"
print "mn (Mininet %s)" % VERSION
exit()
class MininetRunner( object ): class MininetRunner( object ):
"Build, setup, and run Mininet." "Build, setup, and run Mininet."
@@ -179,10 +184,7 @@ class MininetRunner( object ):
opts.add_option( '--pin', action='store_true', opts.add_option( '--pin', action='store_true',
default=False, help="pin hosts to CPU cores " default=False, help="pin hosts to CPU cores "
"(requires --host cfs or --host rt)" ) "(requires --host cfs or --host rt)" )
def fakeversion( *args ): opts.add_option( '--version', action='callback', callback=version )
"Fake version for help2man"
print "mn (development version)"
opts.add_option( '--version', action='callback', callback=fakeversion )
self.options, self.args = opts.parse_args() self.options, self.args = opts.parse_args()
+3
View File
@@ -100,6 +100,9 @@ from mininet.util import quietRun, fixLimits, numCores
from mininet.util import macColonHex, ipStr, ipParse, netParse, ipAdd from mininet.util import macColonHex, ipStr, ipParse, netParse, ipAdd
from mininet.term import cleanUpScreens, makeTerms from mininet.term import cleanUpScreens, makeTerms
# Mininet version: should be consistent with README and LICENSE
VERSION = "2.0.0d1"
class Mininet( object ): class Mininet( object ):
"Network emulation with hosts spawned in network namespaces." "Network emulation with hosts spawned in network namespaces."