OpenRTMpywxs.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 #
3 # @brief WiX wxs file generator for OpenRTM-aist-Python
4 # @date $Date$
5 # @author Norkai Ando <n-ando@aist.go.jp>
6 #
7 # Copyright (C) 2010
8 # Noriaki Ando
9 # Intelligent Systems Research Institute,
10 # National Institute of
11 # Advanced Industrial Science and Technology (AIST), Japan
12 # All rights reserved.
13 #
14 # $Id$
15 #
16 
17 import os
18 import shutil
19 import glob
20 import makewxs
21 
22 data = [
23  ("docs/ClassReference-jp/html", "*.css *.gif *.png *.html *.hhc *.hhk *.hhp"),
24  ("docs/ClassReference-en/html", "*.css *.gif *.png *.html *.hhc *.hhk *.hhp"),
25  ("idlcompiler", "idlcompile.bat idlcompile.py"),
26  ("OpenRTM_aist/utils/rtm-naming", "rtm-naming.py"),
27  ("OpenRTM_aist/examples", "*.conf"),
28  ("OpenRTM_aist/examples/AutoControl", "*.py *.conf"),
29  ("OpenRTM_aist/examples/Composite", "*.py *.conf"),
30  ("OpenRTM_aist/examples/ConfigSample", "*.py *.conf"),
31  ("OpenRTM_aist/examples/ExtTrigger", "*.py *.conf"),
32  ("OpenRTM_aist/examples/MobileRobotCanvas", "*.py *.conf"),
33  ("OpenRTM_aist/examples/NXTRTC", "*.py *.conf"),
34  ("OpenRTM_aist/examples/SeqIO", "*.py *.conf"),
35  ("OpenRTM_aist/examples/SimpleIO", "*.py *.conf"),
36  ("OpenRTM_aist/examples/SimpleService", "*.py *.conf *.idl"),
37  ("OpenRTM_aist/examples/Slider_and_Motor", "*.py *.conf"),
38  ("OpenRTM_aist/examples/TkJoyStick", "*.py *.conf"),
39  ("OpenRTM_aist/examples/TkLRFViewer", "*.py *.conf"),
40  ("OpenRTM_aist/examples/Templates", "*.py *.xml"),
41  ("OpenRTM_aist24", "*.py"),
42  ("OpenRTM_aist24/ext", "*.py"),
43  ("OpenRTM_aist24/ext/sdo", "*.py"),
44  ("OpenRTM_aist24/ext/sdo/observer", "*.py *.idl rtc.conf setup.bat"),
45  ("OpenRTM_aist24/utils/rtcd", "rtcd.py rtcd_python.bat rtcd_python.exe rtcd.conf"),
46  ("OpenRTM_aist24/utils/rtcprof", "rtcprof.py rtcprof_python.bat"),
47  ("OpenRTM_aist24/utils/rtc-template", "*.py"),
48  ("OpenRTM_aist24/RTM_IDL", "*.py *.idl *.pth"),
49  ("OpenRTM_aist24/RTM_IDL/device_interfaces", "*.py *.idl"),
50  ("OpenRTM_aist24/root", "*.pth"),
51  ("OpenRTM_aist25", "*.py"),
52  ("OpenRTM_aist25/ext", "*.py"),
53  ("OpenRTM_aist25/ext/sdo", "*.py"),
54  ("OpenRTM_aist25/ext/sdo/observer", "*.py *.idl rtc.conf setup.bat"),
55  ("OpenRTM_aist25/utils/rtcd", "rtcd.py rtcd_python.bat rtcd_python.exe rtcd.conf"),
56  ("OpenRTM_aist25/utils/rtcprof", "rtcprof.py rtcprof_python.bat"),
57  ("OpenRTM_aist25/utils/rtc-template", "*.py"),
58  ("OpenRTM_aist25/RTM_IDL", "*.py *.idl *.pth"),
59  ("OpenRTM_aist25/RTM_IDL/device_interfaces", "*.py *.idl"),
60  ("OpenRTM_aist25/root", "*.pth"),
61  ("OpenRTM_aist26", "*.py"),
62  ("OpenRTM_aist26/ext", "*.py"),
63  ("OpenRTM_aist26/ext/sdo", "*.py"),
64  ("OpenRTM_aist26/ext/sdo/observer", "*.py *.idl rtc.conf setup.bat"),
65  ("OpenRTM_aist26/utils/rtcd", "rtcd.py rtcd_python.bat rtcd_python.exe rtcd.conf"),
66  ("OpenRTM_aist26/utils/rtcprof", "rtcprof.py rtcprof_python.bat"),
67  ("OpenRTM_aist26/utils/rtc-template", "*.py"),
68  ("OpenRTM_aist26/RTM_IDL", "*.py *.idl *.pth"),
69  ("OpenRTM_aist26/RTM_IDL/device_interfaces", "*.py *.idl"),
70  ("OpenRTM_aist26/root", "*.pth")
71 ]
72 
73 ## Resource path
74 
75 base_dir = os.getenv("OPENRTM_PY")
76 if base_dir == None:
77  base_dir = "C:\\distribution\\OpenRTM-aist-Python-1.1.0\\"
78 else:
79  base_dir = base_dir.replace("\"", "")
80  base_dir += "\\"
81 
82 ## make temporary files
83 
84 src_dir = base_dir + "OpenRTM_aist"
85 temp_dir24 = base_dir + "OpenRTM_aist24"
86 temp_dir25 = base_dir + "OpenRTM_aist25"
87 temp_dir26 = base_dir + "OpenRTM_aist26"
88 dll_list = glob.glob(base_dir + "bin\\x86_win32\\*.dll")
89 dll_cnt = len(dll_list)
90 if os.path.exists(temp_dir24) :
91  shutil.rmtree(temp_dir24)
92 if os.path.exists(temp_dir25) :
93  shutil.rmtree(temp_dir25)
94 if os.path.exists(temp_dir26) :
95  shutil.rmtree(temp_dir26)
96 shutil.copytree(src_dir, temp_dir24)
97 shutil.copytree(src_dir, temp_dir25)
98 shutil.copytree(src_dir, temp_dir26)
99 
100 temp_dir24_root = base_dir + "OpenRTM_aist24\\root"
101 temp_dir25_root = base_dir + "OpenRTM_aist25\\root"
102 temp_dir26_root = base_dir + "OpenRTM_aist26\\root"
103 os.mkdir(temp_dir24_root)
104 os.mkdir(temp_dir25_root)
105 os.mkdir(temp_dir26_root)
106 shutil.copy2(base_dir + "OpenRTM-aist.pth", temp_dir24_root)
107 shutil.copy2(base_dir + "OpenRTM-aist.pth", temp_dir25_root)
108 shutil.copy2(base_dir + "OpenRTM-aist.pth", temp_dir26_root)
109 
110 
111 def path_to_dir_id(path, prefix):
112  # path = "bin/x86_win32" prefix = "omni"
113  # output = "omni_bin_x86_win32"
114  # "." -> "_"
115  output = prefix + "_" + "_".join(path.split("/"))
116  return output.replace(".", "_")
117 
118 def path_to_comp_id(path, prefix):
119  # path = "bin/x86_win32" prefix = "omni"
120  # output = "OmniBinX86_win32"
121  # "." -> "_"
122  output = prefix.capitalize()
123  for c in path.split("/"):
124  output += c.capitalize()
125  return output.replace(".", "_")
126 
127 
128 ## make yaml file
129 
130 for (path, files) in data:
131  # wxs component name
132  comp_name = path_to_comp_id(path, "rtm")
133  comp_name = comp_name.replace("-", "")
134  # wxs directory name
135  dir_name = path_to_dir_id(path, "rtm")
136 
137  path = path.replace("/", "\\")
138 
139  # full path to target directory
140  full_path = base_dir + "\\" + path
141 
142  flist = []
143  for f in files.split(" "):
144  flist += glob.glob(full_path + "\\" + f)
145 
146  curr_path = base_dir + path
147  if curr_path.rfind("\\") == (len(curr_path) -1):
148  curr_path = curr_path[0:len(curr_path)-1]
149 
150  cmd = ["flist",
151  "-c", comp_name,
152  "-o", dir_name + ".yaml",
153  "-p", curr_path]
154  cmd += flist
155  makewxs.main(cmd)
156 
157 
158 ## make wxs file
159 
160 cmd = ["wxs",
161  "-o", "OpenRTM-aist-Python.wxs",
162  "-i", "OpenRTM-aist-Python.wxs.in"]
163 cmd += glob.glob("*.yaml")
164 makewxs.main(cmd)
165 
def path_to_comp_id(path, prefix)
def path_to_dir_id(path, prefix)
def main(argv)
Definition: makewxs.py:157


openrtm_aist_python
Author(s): Shinji Kurihara
autogenerated on Thu Jun 6 2019 19:11:34