py_ext/PythonFileCTNMixin.py
changeset 1911 c1298e7ffe3a
parent 1511 91538d0c242c
child 1680 6db967480b7d
equal deleted inserted replaced
1910:a375e31bf312 1911:c1298e7ffe3a
       
     1 #!/usr/bin/env python
       
     2 # -*- coding: utf-8 -*-
       
     3 
       
     4 # This file is part of Beremiz, a Integrated Development Environment for
       
     5 # programming IEC 61131-3 automates supporting plcopen standard and CanFestival.
       
     6 #
       
     7 # Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
       
     8 #
       
     9 # See COPYING file for copyrights details.
       
    10 #
       
    11 # This program is free software; you can redistribute it and/or
       
    12 # modify it under the terms of the GNU General Public License
       
    13 # as published by the Free Software Foundation; either version 2
       
    14 # of the License, or (at your option) any later version.
       
    15 #
       
    16 # This program is distributed in the hope that it will be useful,
       
    17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    19 # GNU General Public License for more details.
       
    20 #
       
    21 # You should have received a copy of the GNU General Public License
       
    22 # along with this program; if not, write to the Free Software
       
    23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
       
    24 
     1 import os, re
    25 import os, re
     2 from lxml import etree
    26 from lxml import etree
     3 
    27 
     4 from xmlclass import GenerateParserFromXSD
    28 from xmlclass import GenerateParserFromXSD
     5 
    29 
   256         Gen_PyCfile_path = os.path.join(buildpath, "PyCFile_%s.c"%location_str)
   280         Gen_PyCfile_path = os.path.join(buildpath, "PyCFile_%s.c"%location_str)
   257         pycfile = open(Gen_PyCfile_path,'w')
   281         pycfile = open(Gen_PyCfile_path,'w')
   258         pycfile.write(PyCFileContent)
   282         pycfile.write(PyCFileContent)
   259         pycfile.close()
   283         pycfile.close()
   260 
   284 
   261         matiec_flags = '"-l -p -I%s"'%os.path.abspath(
   285         matiec_CFLAGS = '"-I%s"'%os.path.abspath(
   262             self.GetCTRoot().GetIECLibPath())
   286             self.GetCTRoot().GetIECLibPath())
   263 
   287 
   264         return ([(Gen_PyCfile_path, matiec_flags)],
   288         return ([(Gen_PyCfile_path, matiec_CFLAGS)],
   265                 "",
   289                 "",
   266                 True,
   290                 True,
   267                 ("runtime_%s.py"%location_str, file(runtimefile_path,"rb")))
   291                 ("runtime_%s.py"%location_str, file(runtimefile_path,"rb")))
   268 
   292