openrtpwxs.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 #
00003 # @brief WiX wxs file generator for omniORB
00004 # @date $Date$
00005 # @author Norkai Ando <n-ando@aist.go.jp>
00006 #
00007 # Copyright (C) 2010
00008 #     Noriaki Ando
00009 #     Intelligent Systems Research Institute,
00010 #     National Institute of
00011 #         Advanced Industrial Science and Technology (AIST), Japan
00012 #     All rights reserved.
00013 #
00014 # $Id$
00015 #
00016 
00017 data = [
00018     ("",                                  "*.jar *.exe .eclipseproduct"),
00019     ("configuration",                     "*.ini *.jar"),
00020     ("plugins",                           "*.jar"),
00021 ]
00022 
00023 import os
00024 base_dir=os.getenv("RTSE_ROOT")
00025 
00026 if base_dir == None:
00027     base_dir="C:\\distribution\\OpenRTP\\RTSystemEditor"
00028 else:
00029     base_dir = base_dir.replace("\"", "")
00030     base_dir += "\\"
00031 
00032 def path_to_dir_id(path, prefix):
00033     # path = "bin/x86_win32" prefix = "omni"
00034     # output = "omni_bin_x86_win32"
00035     # "." -> "_"
00036     output = prefix + "_" + "_".join(path.split("/"))
00037     return output.replace(".", "_")
00038 
00039 
00040 def path_to_comp_id(path, prefix):
00041     # path = "bin/x86_win32" prefix = "omni"
00042     # output = "OmniBinX86_win32"
00043     # "." -> "_"
00044     output = prefix.capitalize()
00045     for c in path.split("/"):
00046         output += c.capitalize()
00047     return output.replace(".", "_")
00048 
00049 import makewxs
00050 
00051 for (path, files) in data:
00052     # wxs component name
00053     comp_name = path_to_comp_id(path, "openrtp")
00054     # wxs directory name
00055     dir_name = path_to_dir_id(path, "openrtp")
00056 
00057     path = path.replace("/", "\\")
00058 
00059     # full path to target directory
00060     full_path = base_dir + "\\" + path
00061 
00062     import glob
00063     flist = []
00064     for f in files.split(" "):
00065         flist += glob.glob(full_path + "\\" + f)
00066 
00067     cmd = ["flist",
00068            "-c", comp_name,
00069            "-o", dir_name + ".yaml",
00070            "-p",  base_dir + path]
00071     cmd += flist
00072 
00073     makewxs.main(cmd)
00074 
00075 
00076 cmd = ["wxs",
00077        "-o", "OpenRTP_inc.wxs",
00078        "-i", "OpenRTP_inc.wxs.in"]
00079 cmd += glob.glob("*.yaml")
00080 makewxs.main(cmd)


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Thu Aug 27 2015 14:16:38