From: Ethan Jackson Date: Mon, 26 Sep 2011 23:02:14 +0000 (-0700) Subject: stream.py: Make usage() function return a string. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ec394dad53eefc410de4058a2abe7181c1bd58c3;p=openvswitch stream.py: Make usage() function return a string. This will marginally simplify a future patch. --- diff --git a/python/ovs/stream.py b/python/ovs/stream.py index 5180642d..3bb0c10f 100644 --- a/python/ovs/stream.py +++ b/python/ovs/stream.py @@ -302,14 +302,10 @@ class PassiveStream(object): self.socket.close() -def usage(name, active, passive): - print - if active: - print("Active %s connection methods:" % name) - print(" unix:FILE " - "Unix domain socket named FILE") - - if passive: - print("Passive %s connection methods:" % name) - print(" punix:FILE " - "listen on Unix domain socket FILE") +def usage(name): + return """ +Active %s connection methods: + unix:FILE Unix domain socket named FILE + +Passive %s connection methods: + punix:FILE Listen on Unix domain socket FILE""" % (name, name) diff --git a/tests/test-jsonrpc.py b/tests/test-jsonrpc.py index 9da3bd2d..5ce45ad2 100644 --- a/tests/test-jsonrpc.py +++ b/tests/test-jsonrpc.py @@ -212,7 +212,7 @@ usage: %s [OPTIONS] COMMAND [ARG...] request REMOTE METHOD PARAMS send request, print reply notify REMOTE METHOD PARAMS send notification and exit """ % (ovs.util.PROGRAM_NAME, ovs.util.PROGRAM_NAME)) - ovs.stream.usage("JSON-RPC", True, True) + sys.stdout.write(ovs.stream.usage("JSON-RPC") + "\n") ovs.daemon.usage() sys.stdout.write(""" Other options: