From b47cdfea268a1dad1345568a791c017865192513 Mon Sep 17 00:00:00 2001 From: Bob Lantz <rlantz@cs.stanford.edu> Date: Mon, 16 Aug 2010 23:01:06 -0700 Subject: [PATCH] Added pathCheck for additional sanity when OF/OVS isn't installed. --- mininet/moduledeps.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mininet/moduledeps.py b/mininet/moduledeps.py index b21c629f..f954e034 100644 --- a/mininet/moduledeps.py +++ b/mininet/moduledeps.py @@ -2,6 +2,7 @@ from mininet.util import quietRun from mininet.log import info, error, debug +from os import environ def lsmod(): "Return output of lsmod." @@ -54,3 +55,12 @@ def moduleDeps( subtract=None, add=None ): exit( 1 ) else: debug( '*** ' + mod + ' already loaded\n' ) + +def pathCheck( *args ): + "Make sure each program in *args can be found in $PATH." + for arg in args: + if not quietRun( 'which ' + arg ): + error( 'Cannot find required executable %s -' + ' is it installed somewhere in your $PATH?\n(%s)\n' % + ( arg, environ[ 'PATH' ] ) ) + exit( 1 ) -- GitLab