# HG changeset patch
# User Edouard Tisserant
# Date 1517408563 -3600
# Node ID d51d1471939271c1f284c2a012f75819971bfd47
# Parent  b69bea00765a09775e80570843eb394bd228077f
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)

diff -r b69bea00765a -r d51d14719392 NativeLib.py
--- 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"))
diff -r b69bea00765a -r d51d14719392 POULibrary.py
--- 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