# HG changeset patch # User Edouard Tisserant # Date 1424869211 -3600 # Node ID 7a2b344de8cf6f6dffbac50abe85f0dcc56726c6 # Parent 94e620cbd9ded8b0f17f2133810d85fa75ff7d88 Fixed build of tests/python. diff -r 94e620cbd9de -r 7a2b344de8cf py_ext/PythonFileCTNMixin.py --- a/py_ext/PythonFileCTNMixin.py Wed Feb 25 13:59:01 2015 +0100 +++ b/py_ext/PythonFileCTNMixin.py Wed Feb 25 14:00:11 2015 +0100 @@ -74,7 +74,7 @@ pyextname = self.CTNName() varinfos = map(lambda variable : { "name": variable.getname(), - "desc" : repr(variable.getdesc()), + "desc" : repr(variable.getdesc()), "onchangecode" : '"'+variable.getonchange()+\ "('"+variable.getname()+"')\"" \ if variable.getonchange() else '""', @@ -102,7 +102,7 @@ %(desc)s, %(onchange)s, %(opts)s)) -""" % varinfo +""" % varinfo for varinfo in varinfos]) # Runtime calls (start, stop, init, and cleanup) @@ -130,7 +130,7 @@ import ctypes _%(pyextname)sGlobalsDesc = [] __ext_name__ = "%(pyextname)s" -PLCGlobalsDesc.append(( "_%(pyextname)s" , _%(pyextname)sGlobalsDesc )) +PLCGlobalsDesc.append(( "%(pyextname)s" , _%(pyextname)sGlobalsDesc )) %(globalstubs)s ## User code in "global" scope @@ -208,8 +208,8 @@ __SET_VAR(__%(name)s_notifier->,TRIG,,__BOOL_LITERAL(TRUE)); __SET_VAR(__%(name)s_notifier->,CODE,,__STRING_LITERAL(%(onchangelen)d,%(onchangecode)s)); """ - vardec = "\n".join([(vardecfmt + vardeconchangefmt - if varinfo["onchange"] else vardecfmt)% varinfo + vardec = "\n".join([(vardecfmt + vardeconchangefmt + if varinfo["onchange"] else vardecfmt)% varinfo for varinfo in varinfos]) varret = "\n".join([varretfmt % varinfo for varinfo in varinfos]) varpub = "\n".join([(varpubonchangefmt if varinfo["onchange"] else @@ -219,6 +219,9 @@ onchangelen = len(varinfo["onchangecode"]),**varinfo) for varinfo in varinfos if varinfo["onchange"]]) + # TODO : use config name obtained from model instead of default + # "config.h". User cannot change config name, but project imported + # or created in older beremiz vesion could use different name. PyCFileContent = """\ /* * Code generated by Beremiz py_ext confnode diff -r 94e620cbd9de -r 7a2b344de8cf tests/python/plc.xml --- a/tests/python/plc.xml Wed Feb 25 13:59:01 2015 +0100 +++ b/tests/python/plc.xml Wed Feb 25 14:00:11 2015 +0100 @@ -1,7 +1,7 @@ - + @@ -1297,7 +1297,7 @@ - + diff -r 94e620cbd9de -r 7a2b344de8cf tests/python/py_ext_0@py_ext/pyfile.xml --- a/tests/python/py_ext_0@py_ext/pyfile.xml Wed Feb 25 13:59:01 2015 +0100 +++ b/tests/python/py_ext_0@py_ext/pyfile.xml Wed Feb 25 14:00:11 2015 +0100 @@ -6,12 +6,12 @@