[ovs-dev] [PATCH 1/2] ovs-dev.py: Split out checking for program existence.

Joe Stringer joestringer at nicira.com
Tue Jul 1 03:10:19 UTC 2014


Signed-off-by: Joe Stringer <joestringer at nicira.com>
---
 utilities/ovs-dev.py |   21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/utilities/ovs-dev.py b/utilities/ovs-dev.py
index 74143ca..91732e1 100755
--- a/utilities/ovs-dev.py
+++ b/utilities/ovs-dev.py
@@ -47,6 +47,14 @@ def _sh(*args, **kwargs):
         subprocess.call(args, shell=shell)
 
 
+def program_exists(prog):
+    try:
+        _sh("%s --version" % prog, check=True)
+        return True
+    except subprocess.CalledProcessError:
+        return False
+
+
 def uname():
     return _sh("uname", "-r", capture=True)[0].strip()
 
@@ -95,17 +103,8 @@ def conf():
     os.chdir(BUILD_GCC)
     _sh(*(configure + ["--with-linux=/lib/modules/%s/build" % uname()]))
 
-    try:
-        _sh("clang --version", check=True)
-        clang = True
-    except subprocess.CalledProcessError:
-        clang = False
-
-    try:
-        _sh("sparse --version", check=True)
-        sparse = True
-    except subprocess.CalledProcessError:
-        sparse = False
+    clang = program_exists("clang")
+    sparse = program_exists("sparse")
 
     if clang:
         try:
-- 
1.7.10.4




More information about the dev mailing list