[openrtm-commit:03276] r965 - trunk/OpenRTM-aist-Python/OpenRTM_aist

openrtm @ openrtm.org openrtm @ openrtm.org
2018年 3月 26日 (月) 16:14:44 JST


Author: miyamoto
Date: 2018-03-26 16:14:44 +0900 (Mon, 26 Mar 2018)
New Revision: 965

Modified:
   trunk/OpenRTM-aist-Python/OpenRTM_aist/ManagerConfig.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/ManagerServant.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/ModuleManager.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/StringUtil.py
Log:
[compat,bugfix,->RELENG_1_2] fixed bug.

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/ManagerConfig.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/ManagerConfig.py	2018-03-22 00:10:18 UTC (rev 964)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/ManagerConfig.py	2018-03-26 07:14:44 UTC (rev 965)
@@ -288,9 +288,9 @@
         if pos > 0:
           key = arg[:pos]
           value = arg[pos+1:]
-          key = OpenRTM_aist.unescape(key)
+          #key = OpenRTM_aist.unescape(key)
           key = key.strip()
-          value = OpenRTM_aist.unescape(value)
+          #value = OpenRTM_aist.unescape(value)
           value = value.strip()
           self._argprop.setProperty(key,value)
 

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/ManagerServant.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/ManagerServant.py	2018-03-22 00:10:18 UTC (rev 964)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/ManagerServant.py	2018-03-26 07:14:44 UTC (rev 965)
@@ -1364,6 +1364,7 @@
       
       if platform.system() == "Windows":
         cmd = "cmd /c " + rtcd_cmd
+        load_path = load_path.replace("\\","\\\\")
       else:
         cmd = rtcd_cmd
       cmd += " -o " + "manager.is_master:NO"
@@ -1400,7 +1401,7 @@
         del guard_slave
 
 
-
+  
       ret = OpenRTM_aist.launch_shell(cmd)
 
       

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/ModuleManager.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/ModuleManager.py	2018-03-22 00:10:18 UTC (rev 964)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/ModuleManager.py	2018-03-26 07:14:44 UTC (rev 965)
@@ -543,6 +543,7 @@
     paths.extend(self._loadPath)
     paths = self.deleteSamePath(paths)
     
+    
 
     suffixes = lprop.getProperty("suffixes").split(",")
 
@@ -560,7 +561,10 @@
         OpenRTM_aist.eraseHeadBlank(tmp)
         suffix = tmp[0]
         
-        tmp = glob.glob(path + os.sep + '*.' + suffix)
+        tmp = []
+        OpenRTM_aist.getFileList(path,suffix,tmp)
+        
+        #tmp = glob.glob(path + os.sep + '*.' + suffix)
         if lang == "Python":
           for f in tmp:
             if f.find("__init__.py") != -1:
@@ -836,8 +840,9 @@
   def findFile(self, fname, load_path):
     file_name = fname
     for path in load_path:
-      if fname.find(".py") == -1:
-        f = str(path) + os.sep + str(file_name)+".py"
+      suffix = self._properties.getProperty("manager.modules.Python.suffixes")
+      if fname.find("."+suffix) == -1:
+        f = str(path) + os.sep + str(file_name)+"."+suffix
       else:
         f = str(path)+ os.sep + str(file_name)
       if self.fileExist(f):
@@ -844,6 +849,11 @@
         f = f.replace("\\","/")
         f = f.replace("//","/")
         return f
+      filelist = []
+      OpenRTM_aist.findFile(path,file_name,filelist)
+      
+      if len(filelist) > 0:
+        return filelist[0]
     return ""
 
 
@@ -863,8 +873,9 @@
   # @endif
   def fileExist(self, filename):
     fname = filename
-    if fname.find(".py") == -1:
-      fname = str(filename)+".py"
+    suffix = self._properties.getProperty("manager.modules.Python.suffixes")
+    if fname.find("."+suffix) == -1:
+      fname = str(filename)+"."+suffix
 
     if os.path.isfile(fname):
       return True

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/StringUtil.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/StringUtil.py	2018-03-22 00:10:18 UTC (rev 964)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/StringUtil.py	2018-03-26 07:14:44 UTC (rev 965)
@@ -16,6 +16,8 @@
 
 import os
 import sys
+import glob
+
 if sys.version_info[0] == 3:
     long = int
 
@@ -740,4 +742,63 @@
         ret_str = ret_str + s
     return ret_str
     
-        
\ No newline at end of file
+
+
+##
+# @if jp
+# @brief »ØÄê¥Õ¥¡¥¤¥ë̾¤ò»ØÄê¥Ç¥£¥ì¥¯¥È¥ê¤«¤éõºº¤¹¤ë
+#
+# @param dir ¥Ç¥£¥ì¥¯¥È¥ê¥Ñ¥¹
+# @param filename ¥Õ¥¡¥¤¥ë̾
+# @param filelist ¥Õ¥¡¥¤¥ë°ìÍ÷
+#
+#
+#
+# @else
+# @brief 
+#
+# @param dir 
+# @param filename
+# @param filelist 
+#
+#
+# @endif
+def findFile(dir, filename, filelist):
+	dirs = glob.glob(os.path.join(dir,"*"))
+	for d in dirs:
+		if os.path.isdir(d):
+			findFile(d, filename, filelist)
+	files = glob.glob(os.path.join(dir,filename))
+	for f in files:
+		if os.path.isfile(d):
+			filelist.append(f)
+
+
+##
+# @if jp
+# @brief ¥Õ¥¡¥¤¥ë°ìÍ÷¤ò»ØÄê¥Ç¥£¥ì¥¯¥È¥ê¤«¤éõºº¤¹¤ë
+#
+# @param dir ¥Ç¥£¥ì¥¯¥È¥ê¥Ñ¥¹
+# @param ext ³ÈÄ¥»Ò
+# @param filelist ¥Õ¥¡¥¤¥ë°ìÍ÷
+#
+#
+#
+# @else
+# @brief 
+#
+# @param dir 
+# @param ext 
+# @param filelist 
+#
+#
+# @endif
+def getFileList(dir, ext, filelist):
+    dirs = glob.glob(os.path.join(dir,"*"))
+    for d in dirs:
+        if os.path.isdir(d):
+            getFileList(d, ext, filelist)
+    files = glob.glob(os.path.join(dir,"*."+ext))
+    for f in files:
+        if os.path.isfile(d):
+            filelist.append(f)
\ No newline at end of file



openrtm-commit メーリングリストの案内