qnx_qconfig.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 import subprocess, re, sys
00004 
00005 def check_qconfig(config, search_key, expected_str):
00006     global ret
00007 
00008     tag =  re.findall(search_key, config)
00009     if tag :
00010         tag = tag[-1]
00011     else:
00012         tag = "Could nof find " + search_key
00013 
00014     print "%s\t\t\t\t" % (tag),
00015     if tag == expected_str :
00016         print "Ok"
00017     else:
00018         print "False"
00019         ret = False
00020 
00021 def qnx_qconfig() :
00022     global ret
00023 
00024     config = subprocess.Popen(["qconfig", "-a"], stdout=subprocess.PIPE).communicate()[0]
00025 
00026     # installation-name: QNX Software Development Platform 6.5.0
00027     # installation-base: /usr/qnx650/
00028     # installation-host: /usr/qnx650/host/qnx6/x86/
00029     # installation-target: /usr/qnx650/target/qnx6/
00030 
00031     ret = True
00032 
00033     print "  Check Installation Name .. ",
00034     check_qconfig(config, "installation-name: (.+)", "QNX Software Development Platform 6.5.0")
00035 
00036     print "  Check Installation Base .. ",
00037     check_qconfig(config, "installation-base: (.+)", "/usr/qnx650/")
00038 
00039     print "  Check Installation Host .. ",
00040     check_qconfig(config, "installation-host: (.+)", "/usr/qnx650/host/qnx6/x86/")
00041 
00042     print "  Check Installation Target .. ",
00043     check_qconfig(config, "installation-target: (.+)", "/usr/qnx650/target/qnx6/")
00044 
00045     print re.sub('(^|\n)', '\n  -', config)
00046     return ret


hironx_ros_bridge
Author(s): Kei Okada
autogenerated on Mon Oct 6 2014 07:19:42