Back to index

salome-kernel  6.5.0
prepare_generating_doc.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 # Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00003 #
00004 # This library is free software; you can redistribute it and/or
00005 # modify it under the terms of the GNU Lesser General Public
00006 # License as published by the Free Software Foundation; either
00007 # version 2.1 of the License.
00008 #
00009 # This library is distributed in the hope that it will be useful,
00010 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 # Lesser General Public License for more details.
00013 #
00014 # You should have received a copy of the GNU Lesser General Public
00015 # License along with this library; if not, write to the Free Software
00016 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00017 #
00018 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00019 #
00020 
00021 import sys, re
00022 outfile = open(sys.argv[1], 'wb')
00023 isCom = False
00024 for line in open(sys.argv[2], 'rb').readlines():
00025     if re.match('class '+sys.argv[3]+'DC', line): 
00026         continue
00027     n = line.find('"""')
00028     n1 = line[(n+2):].find('"""')
00029     if (n > -1) and (n1 > -1):
00030         continue
00031     if isCom:
00032         if n > -1:
00033             isCom = False
00034         continue
00035     else:
00036         if n > -1:
00037             isCom = True
00038             continue       
00039     line = re.sub(r'^\s+#', '#', line) 
00040     line = re.sub(r'^\s+def', 'def', line) 
00041     line = re.sub(sys.argv[3]+'DC', sys.argv[3], line)
00042     outfile.write(line)
00043 outfile.close()