Fix relative matiec path problem
authorgreg
Thu, 15 Oct 2009 17:39:26 +0200
changeset 418 01f6bfc01251
parent 416 3b3f7f5a8e40
child 420 c093ec48f2fd
Fix relative matiec path problem
Fix warning in generate common_main
plugger.py
plugins/c_ext/c_ext.py
plugins/python/python.py
--- a/plugger.py	Fri Oct 09 17:52:00 2009 +0200
+++ b/plugger.py	Thu Oct 15 17:39:26 2009 +0200
@@ -658,9 +658,6 @@
 else:
     exe_ext=""
 
-iec2c_path = os.path.join(base_folder, "matiec", "iec2c"+exe_ext)
-ieclib_path = os.path.join(base_folder, "matiec", "lib")
-
 # import for project creation timestamping
 from threading import Timer, Lock, Thread, Semaphore
 from time import localtime
@@ -748,6 +745,9 @@
         self._connector = None
         self.Deleting = False
         
+        self.iec2c_path = os.path.join(base_folder, "matiec", "iec2c"+exe_ext)
+        self.ieclib_path = os.path.join(base_folder, "matiec", "lib")
+        
         # Setup debug information
         self.IECdebug_datas = {}
         self.IECdebug_lock = Lock()
@@ -794,6 +794,12 @@
     def GetPlugRoot(self):
         return self
 
+    def GetIECLibPath(self):
+        return self.ieclib_path
+    
+    def GetIEC2cPath(self):
+        return self.iec2c_path
+    
     def GetCurrentLocation(self):
         return ()
 
@@ -1043,8 +1049,8 @@
         status, result, err_result = ProcessLogger(
                self.logger,
                "\"%s\" -f -I \"%s\" -T \"%s\" \"%s\""%(
-                         iec2c_path,
-                         ieclib_path, 
+                         self.iec2c_path,
+                         self.ieclib_path, 
                          buildpath,
                          self._getIECcodepath()),
                no_stdout=True, no_stderr=True).spin()
@@ -1094,7 +1100,7 @@
         # Keep track of generated C files for later use by self.PlugGenerate_C
         self.PLCGeneratedCFiles = C_files
         # compute CFLAGS for plc
-        self.plcCFLAGS = "\"-I"+ieclib_path+"\""
+        self.plcCFLAGS = "\"-I"+self.ieclib_path+"\""
         return True
 
     def GetBuilder(self):
@@ -1261,9 +1267,9 @@
             plc_main_code = targets.code("plc_common_main") % {
                 "calls_prototypes":"\n".join([(
                       "int __init_%(s)s(int argc,char **argv);\n"+
-                      "void __cleanup_%(s)s();\n"+
-                      "void __retrieve_%(s)s();\n"+
-                      "void __publish_%(s)s();")%{'s':locstr} for locstr in locstrs]),
+                      "void __cleanup_%(s)s(void);\n"+
+                      "void __retrieve_%(s)s(void);\n"+
+                      "void __publish_%(s)s(void);")%{'s':locstr} for locstr in locstrs]),
                 "retrieve_calls":"\n    ".join([
                       "__retrieve_%s();"%locstr for locstr in locstrs]),
                 "publish_calls":"\n    ".join([ #Call publish in reverse order
--- a/plugins/c_ext/c_ext.py	Fri Oct 09 17:52:00 2009 +0200
+++ b/plugins/c_ext/c_ext.py	Thu Oct 15 17:39:26 2009 +0200
@@ -341,10 +341,7 @@
         cfile.write(text)
         cfile.close()
         
-        if wx.Platform == '__WXMSW__':
-            matiec_flags = " -I../../matiec/lib"
-        else:
-            matiec_flags = " -I../matiec/lib"
+        matiec_flags = '"-I%s"'%os.path.abspath(self.GetPlugRoot().GetIECLibPath())
         
         return [(Gen_Cfile_path, str(self.CExtension.getCFLAGS() + matiec_flags))],str(self.CExtension.getLDFLAGS()),True
         
--- a/plugins/python/python.py	Fri Oct 09 17:52:00 2009 +0200
+++ b/plugins/python/python.py	Thu Oct 15 17:39:26 2009 +0200
@@ -264,9 +264,6 @@
         runtimefile.write(self.GetPythonCode())
         runtimefile.close()
         
-        if wx.Platform == '__WXMSW__':
-            matiec_flags = " -I../../matiec/lib"
-        else:
-            matiec_flags = " -I../matiec/lib"
+        matiec_flags = '"-I%s"'%os.path.abspath(self.GetPlugRoot().GetIECLibPath())
         
         return [(Gen_Pythonfile_path, matiec_flags)], "", True, ("runtime_%s.py"%location_str, file(runtimefile_path,"rb"))