]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Python examples into the doc.
authorageay <ageay>
Thu, 12 Apr 2012 08:20:40 +0000 (08:20 +0000)
committerageay <ageay>
Thu, 12 Apr 2012 08:20:40 +0000 (08:20 +0000)
doc/doxygen/BuildPyExamplesFromCPP.py [new file with mode: 0644]

diff --git a/doc/doxygen/BuildPyExamplesFromCPP.py b/doc/doxygen/BuildPyExamplesFromCPP.py
new file mode 100644 (file)
index 0000000..653ab03
--- /dev/null
@@ -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