Add some class factory function to ease declaration of simple POU libraries in customizations (i.e. TC6 XML file only, no special C code generation)
--- a/NativeLib.py Wed Jan 31 15:20:42 2018 +0100
+++ b/NativeLib.py Wed Jan 31 15:22:43 2018 +0100
@@ -26,9 +26,7 @@
from __future__ import absolute_import
import util.paths as paths
-from POULibrary import POULibrary
+from POULibrary import SimplePOULibraryFactory
-
-class NativeLibrary(POULibrary):
- def GetLibraryPath(self):
- return paths.AbsNeighbourFile(__file__, "NativeLib.xml")
+NativeLibrary = SimplePOULibraryFactory(
+ paths.AbsNeighbourFile(__file__, "NativeLib.xml"))
--- a/POULibrary.py Wed Jan 31 15:20:42 2018 +0100
+++ b/POULibrary.py Wed Jan 31 15:22:43 2018 +0100
@@ -58,3 +58,10 @@
def Generate_C(self, buildpath, varlist, IECCFLAGS):
# Pure python or IEC libs doesn't produce C code
return ((""), [], False), ""
+
+
+def SimplePOULibraryFactory(path):
+ class SimplePOULibrary(POULibrary):
+ def GetLibraryPath(self):
+ return path
+ return SimplePOULibrary