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.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()