py_ext/PythonFileCTNMixin.py
changeset 1734 750eeb7230a1
parent 1732 94ffe74e6895
child 1736 7e61baa047f0
equal deleted inserted replaced
1733:dea107dce0c4 1734:750eeb7230a1
   169 
   169 
   170 """ % locals()
   170 """ % locals()
   171 
   171 
   172         # write generated content to python file
   172         # write generated content to python file
   173         runtimefile_path = os.path.join(buildpath,
   173         runtimefile_path = os.path.join(buildpath,
   174             "runtime_%s.py"%location_str)
   174             "runtime_%s.py" % location_str)
   175         runtimefile = open(runtimefile_path, 'w')
   175         runtimefile = open(runtimefile_path, 'w')
   176         runtimefile.write(PyFileContent.encode('utf-8'))
   176         runtimefile.write(PyFileContent.encode('utf-8'))
   177         runtimefile.close()
   177         runtimefile.close()
   178 
   178 
   179         # C code for safe global variables access
   179         # C code for safe global variables access
   277 void __publish_%(location_str)s(void){
   277 void __publish_%(location_str)s(void){
   278 %(varpub)s
   278 %(varpub)s
   279 }
   279 }
   280 """ % locals()
   280 """ % locals()
   281 
   281 
   282         Gen_PyCfile_path = os.path.join(buildpath, "PyCFile_%s.c"%location_str)
   282         Gen_PyCfile_path = os.path.join(buildpath, "PyCFile_%s.c" % location_str)
   283         pycfile = open(Gen_PyCfile_path,'w')
   283         pycfile = open(Gen_PyCfile_path,'w')
   284         pycfile.write(PyCFileContent)
   284         pycfile.write(PyCFileContent)
   285         pycfile.close()
   285         pycfile.close()
   286 
   286 
   287         matiec_CFLAGS = '"-I%s"'%os.path.abspath(
   287         matiec_CFLAGS = '"-I%s"' % os.path.abspath(
   288             self.GetCTRoot().GetIECLibPath())
   288             self.GetCTRoot().GetIECLibPath())
   289 
   289 
   290         return ([(Gen_PyCfile_path, matiec_CFLAGS)],
   290         return ([(Gen_PyCfile_path, matiec_CFLAGS)],
   291                 "",
   291                 "",
   292                 True,
   292                 True,
   293                 ("runtime_%s.py"%location_str, file(runtimefile_path,"rb")))
   293                 ("runtime_%s.py" % location_str, file(runtimefile_path,"rb")))
   294 
   294