From: ageay Date: Thu, 12 Apr 2012 08:20:40 +0000 (+0000) Subject: Python examples into the doc. X-Git-Tag: V6_main_FINAL~676 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=713a2edf1f0cb6454bb7c48be7f8fc004f0eb250;p=tools%2Fmedcoupling.git Python examples into the doc. --- diff --git a/doc/doxygen/BuildPyExamplesFromCPP.py b/doc/doxygen/BuildPyExamplesFromCPP.py new file mode 100644 index 000000000..653ab03ad --- /dev/null +++ b/doc/doxygen/BuildPyExamplesFromCPP.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +import sys +import re +import os + +def Cpp2Python(st): + st=st.replace("C++","Python") + st=st.replace("Cxx","Py") + st=st.replace("Cpp","Py") + st=st.replace("cxx","py") + st=st.replace("cpp","py") + return st + +fCpp=file(sys.argv[1],"r") +cppCont=fCpp.readlines() ; del fCpp +pyCont=cppCont[:] +pyCont=[elt.replace("medcouplingcppexamples","medcouplingpyexamples") for elt in pyCont] +pyCont=[Cpp2Python(elt) for elt in pyCont] + +outFileName=os.path.join(sys.argv[2],os.path.basename(sys.argv[1])) + +f=file(os.path.splitext(outFileName)[0]+".dox","w") +f.writelines(cppCont+pyCont) ; del f