[openrtm-commit:01105] r592 - trunk/OpenRTM-aist-Python

openrtm @ openrtm.org openrtm @ openrtm.org
2013年 6月 27日 (木) 18:21:46 JST


Author: n-ando
Date: 2013-06-27 18:21:46 +0900 (Thu, 27 Jun 2013)
New Revision: 592

Modified:
   trunk/OpenRTM-aist-Python/setup.py
Log:
Script coding: specifier problem on Windows, error about no rtcprof_python.py script problems have been solved. refs #2774

Modified: trunk/OpenRTM-aist-Python/setup.py
===================================================================
--- trunk/OpenRTM-aist-Python/setup.py	2013-06-27 09:19:55 UTC (rev 591)
+++ trunk/OpenRTM-aist-Python/setup.py	2013-06-27 09:21:46 UTC (rev 592)
@@ -343,9 +343,19 @@
     # end of conv_encoding()
   temp_fname = file_name + ".tmp"
   outfd = open(temp_fname, "w")
+  def coding_name(coding):
+    conv = {"euc_jp": "euc-jp",
+            "shift_jis": "cp932"}
+    if conv.has_key(coding):
+      return conv[coding]
+    return coding
+  sub_str = "coding: " + coding_name(char_code)
+  import re
   for line in open(file_name, "r"):
     try:
       outdata = conv_encoding(line.rstrip('\r\n'), char_code)
+      outdata = re.sub("coding: [^ ]*", sub_str, outdata)
+      outdata = re.sub("encoding: [^ ]*", sub_str, outdata)
     except Exception, e:
       print "Exception cought in " + file_name + ": " + line
       print e
@@ -564,6 +574,11 @@
   """
   description = "Copying pure python modules into build directory."
   def run(self):
+    # Preparering rtcprof_python.py for Windows
+    if os_is() == "win32":
+      rtcprof_dir = os.path.join("OpenRTM_aist", "utils", "rtcprof/")
+      self.copy_file(os.path.join(rtcprof_dir, "rtcprof.py"),
+                     os.path.join(rtcprof_dir, "rtcprof_python.py"))
     _build_py.run(self)
     # copying OpenRTM-aist.pth file
     self.copy_file(os.path.join(".", "OpenRTM-aist.pth"), self.build_lib,



More information about the openrtm-commit mailing list