Add support for generating man page from mn --help.

This commit is contained in:
Bob Lantz
2012-07-01 23:23:56 -07:00
parent 0809105bed
commit f2e7884ade
2 changed files with 18 additions and 3 deletions
+9 -2
View File
@@ -1,7 +1,8 @@
MININET = mininet/*.py MININET = mininet/*.py
TEST = mininet/test/*.py TEST = mininet/test/*.py
EXAMPLES = examples/*.py EXAMPLES = examples/*.py
BIN = bin/mn MN = bin/mn
BIN = $(MN)
PYSRC = $(MININET) $(TEST) $(EXAMPLES) $(BIN) PYSRC = $(MININET) $(TEST) $(EXAMPLES) $(BIN)
MNEXEC = mnexec MNEXEC = mnexec
P8IGN = E251,E201,E302,E202 P8IGN = E251,E201,E302,E202
@@ -34,6 +35,12 @@ develop: $(MNEXEC)
install $(MNEXEC) /usr/local/bin/ install $(MNEXEC) /usr/local/bin/
python setup.py develop python setup.py develop
doc: man: mn.1
mn.1: $(MN)
help2man -N -n "create a Mininet network." --no-discard-stderr $(MN) \
> mn.1
doc: man
doxygen doxygen.cfg doxygen doxygen.cfg
+9 -1
View File
@@ -134,7 +134,11 @@ class MininetRunner( object ):
else: else:
raise Exception( 'Custom file name not found' ) raise Exception( 'Custom file name not found' )
opts = OptionParser() desc = ( "The %prog utility creates Mininet network from the\n"
"command line. It can create parametrized topologies,\n"
"invoke the Mininet CLI, and run tests." )
opts = OptionParser( description=desc )
addDictOption( opts, SWITCHES, SWITCHDEF, 'switch' ) addDictOption( opts, SWITCHES, SWITCHDEF, 'switch' )
addDictOption( opts, HOSTS, HOSTDEF, 'host' ) addDictOption( opts, HOSTS, HOSTDEF, 'host' )
addDictOption( opts, CONTROLLERS, CONTROLLERDEF, 'controller' ) addDictOption( opts, CONTROLLERS, CONTROLLERDEF, 'controller' )
@@ -175,6 +179,10 @@ 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 ):
"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()