Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 import os, glob, sys, _winreg
00009
00010
00011
00012
00013
00014
00015 argvs = sys.argv
00016 argc = len(argvs)
00017 inst_ver = "all"
00018 examples_path = ""
00019
00020 if argc > 1:
00021 inst_ver = str(argvs[1])
00022 examples_path = str(argvs[2])
00023
00024
00025
00026
00027
00028 def idl_compile(chk_ver, reg_key, exa_path):
00029 reg_root = _winreg.HKEY_LOCAL_MACHINE
00030
00031 try:
00032 InstallPath = None
00033 index = 0
00034
00035
00036 reg_hdl = _winreg.OpenKey(reg_root, reg_key)
00037 reg_data = _winreg.EnumValue(reg_hdl, index)
00038 InstallPath = reg_data[1]
00039 _winreg.CloseKey(reg_hdl)
00040
00041 if InstallPath.rfind("\\") != (len(InstallPath) -1):
00042 InstallPath += "\\"
00043
00044
00045 curr_dir = InstallPath + "Lib\site-packages\OpenRTM_aist\RTM_IDL"
00046 os.chdir(curr_dir)
00047
00048
00049 idl_cmd = InstallPath + "omniidl.exe -bpython"
00050 idl_list = glob.glob("*.idl")
00051 idl_cnt = len(idl_list)
00052 for i in range(idl_cnt):
00053 idl_cmd += " " + idl_list[i]
00054
00055
00056 os.system(idl_cmd)
00057
00058
00059
00060 idl_cmd = InstallPath + "omniidl.exe -bpython"
00061 idl_list = glob.glob("device_interfaces\*.idl")
00062 idl_cnt = len(idl_list)
00063 for i in range(idl_cnt):
00064 idl_cmd += " " + idl_list[i]
00065
00066
00067 os.system(idl_cmd)
00068
00069
00070 ExamplesPath = exa_path
00071 if ExamplesPath.rfind("\\") != (len(ExamplesPath) -1):
00072 ExamplesPath += "\\"
00073
00074 curr_dir = ExamplesPath + "SimpleService"
00075 os.chdir(curr_dir)
00076
00077
00078 idl_cmd = InstallPath + "omniidl.exe -bpython MyService.idl"
00079 os.system(idl_cmd)
00080
00081 return True
00082
00083 except EnvironmentError:
00084 return False
00085
00086 return False
00087
00088
00089
00090
00091
00092 if (inst_ver == "all") or (inst_ver == "2.4"):
00093 py_ver = "2.4"
00094 py_key = "SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath"
00095 ret = idl_compile(py_ver, py_key, examples_path)
00096 if ret == False:
00097 print "Python %s Not Installed." % py_ver
00098
00099
00100
00101
00102
00103 if (inst_ver == "all") or (inst_ver == "2.5"):
00104 py_ver = "2.5"
00105 py_key = "SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath"
00106 ret = idl_compile(py_ver, py_key, examples_path)
00107 if ret == False:
00108 print "Python %s Not Installed." % py_ver
00109
00110
00111
00112
00113
00114 if (inst_ver == "all") or (inst_ver == "2.6"):
00115 py_ver = "2.6"
00116 py_key = "SOFTWARE\\Python\\PythonCore\\2.6\\InstallPath"
00117 ret = idl_compile(py_ver, py_key, examples_path)
00118 if ret == False:
00119 print "Python %s Not Installed." % py_ver
00120