Index: /issm/trunk-jpl/externalpackages/boost/install.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/boost/install.sh	(revision 11943)
+++ /issm/trunk-jpl/externalpackages/boost/install.sh	(revision 11944)
@@ -1,3 +1,11 @@
 #!/bin/bash
+
+#Note of caution:  stop after boostrap phase, and run 
+#bjam --debug-configuration, to figure out which paths boost is using to include 
+#python. make sure everyone of these paths is covered by python. If not, just make 
+#symlinks in externalpackages/python to what boost is expecting. Ther is NO WAY 
+#to get the boost library to include python support without doing that. 
+
+
 
 #Some cleanup
Index: /issm/trunk-jpl/externalpackages/matlab/install.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/matlab/install.sh	(revision 11943)
+++ /issm/trunk-jpl/externalpackages/matlab/install.sh	(revision 11944)
@@ -5,5 +5,5 @@
 
 #Select or create a new simlink
-ln -s /usr/local/pkgs/matlab-7.6/ install
+#ln -s /usr/local/pkgs/matlab-7.6/ install
 #ln -s /usr/local/matlab704/ install
 #ln -s /usr/local/matlab711/ install
@@ -15,4 +15,4 @@
 #ln -s /Applications/MATLAB_R2009a.app/ install
 #ln -s /Applications/MATLAB_R2010a.app/ install
-#ln -s /Applications/MATLAB_R2011b.app/ install
+ln -s /Applications/MATLAB_R2012a.app/ install
 #ln -s /Applications/MATLAB*.app/ install
Index: /issm/trunk-jpl/externalpackages/python/install.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/python/install.sh	(revision 11943)
+++ /issm/trunk-jpl/externalpackages/python/install.sh	(revision 11944)
@@ -1,8 +1,11 @@
 #!/bin/bash
-#wget http://python.org/ftp/python/3.2.2/Python-3.2.2.tgz
+#wget http://python.org/ftp/python/version/Python-version.tgz
+
+#version=3.2.2
+version=2.7.2
 
 #Some cleanup
 rm -rf install src
-rm -rf Python-3.2.2
+rm -rf Python-$version
 mkdir install src
 
@@ -11,7 +14,7 @@
 
 #Untar and move python into install directory
-tar -zxvf  Python-3.2.2.tgz
-mv Python-3.2.2/* src
-rm -rf Python-3.2.2
+tar -zxvf  Python-$version.tgz
+mv Python-$version/* src
+rm -rf Python-$version
 
 #Configure doxygen
Index: /issm/trunk-jpl/externalpackages/scipy/install-macosx64.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/scipy/install-macosx64.sh	(revision 11943)
+++ /issm/trunk-jpl/externalpackages/scipy/install-macosx64.sh	(revision 11944)
@@ -4,5 +4,5 @@
 #2 install scipy
 #3 erase
-install=1
+install=2
 
 
Index: /issm/trunk-jpl/externalpackages/triangle/install-macosx64.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/triangle/install-macosx64.sh	(revision 11943)
+++ /issm/trunk-jpl/externalpackages/triangle/install-macosx64.sh	(revision 11944)
@@ -1,3 +1,7 @@
 #!/bin/bash
+
+#use matlab? 
+matlab=0
+
 
 #Some cleanup 
@@ -15,5 +19,9 @@
 
 #Patch triangle.c 
-patch triangle.c ../triangle.c.patch
+if [[ $matlab == "1" ]];then
+	patch triangle.c ../triangle.c.patch.matlab
+else
+	patch triangle.c ../triangle.c.patch.python
+fi
 
 #Compile triangle
Index: /issm/trunk-jpl/src/c/Container/Options.cpp
===================================================================
--- /issm/trunk-jpl/src/c/Container/Options.cpp	(revision 11943)
+++ /issm/trunk-jpl/src/c/Container/Options.cpp	(revision 11944)
@@ -43,5 +43,5 @@
 		if (!mxIsClass(prhs[i],"char")) _error_("Argument %d must be name of option.",i+1);
 
-		FetchMatlabData(&name,prhs[i]);
+		FetchData(&name,prhs[i]);
 		if (i+1 == nrhs) _error_("Argument %d must exist and be value of option \"%s\".",i+2,name);
 
Index: /issm/trunk-jpl/src/c/Makefile.am
===================================================================
--- /issm/trunk-jpl/src/c/Makefile.am	(revision 11943)
+++ /issm/trunk-jpl/src/c/Makefile.am	(revision 11944)
@@ -208,4 +208,7 @@
 					./shared/Elements/GetNumberOfDofs.cpp\
 					./shared/String/sharedstring.h\
+					./shared/Wrapper/wrappershared.h\
+					./shared/Wrapper/ModuleBoot.cpp\
+					./shared/Wrapper/ModuleEnd.cpp\
 					./toolkits/mpi/mpiincludes.h\
 					./toolkits/mpi/patches/mpipatches.h\
@@ -253,4 +256,6 @@
 					./modules/OutputResultsx/OutputResultsx.h\
 					./modules/OutputResultsx/OutputResultsx.cpp\
+					./modules/TriMeshx/TriMeshx.h\
+					./modules/TriMeshx/TriMeshx.cpp\
 					./modules/InputDuplicatex/InputDuplicatex.h\
 					./modules/InputDuplicatex/InputDuplicatex.cpp\
@@ -693,8 +698,5 @@
 #Matlab sources  {{{1
 matlab_sources= ./shared/Matlab/matlabshared.h\
-				    ./shared/Matlab/ModuleBoot.cpp\
-				    ./shared/Matlab/ModuleEnd.cpp\
 				    ./shared/Matlab/mxGetAssignedField.cpp\
-				    ./shared/Matlab/mxGetField.cpp\
 				    ./shared/Matlab/CheckNumMatlabArguments.cpp\
 				    ./toolkits/matlab/matlabincludes.h\
@@ -707,4 +709,9 @@
 				    ./io/Matlab/FetchMatlabData.cpp\
 				    ./io/Matlab/OptionParse.cpp
+#}}}
+#Python sources  {{{1
+python_sources=     ./io/Python/pythonio.h\
+				    ./io/Python/WritePythonData.cpp\
+				    ./io/Python/FetchPythonData.cpp
 #}}}
 #Petsc sources  {{{1
@@ -736,4 +743,5 @@
 					./toolkits/petsc/patches/MatInvert.cpp\
 					./toolkits/petsc/patches/MatMultPatch.cpp\
+					./toolkits/petsc/patches/ISSMToPetscMatrixType.cpp\
 					./toolkits/petsc/patches/ISSMToPetscInsertMode.cpp\
 					./toolkits/petsc/patches/ISSMToPetscNormMode.cpp\
@@ -928,7 +936,15 @@
 libISSM_a_SOURCES += $(bamg_sources)
 libISSM_a_SOURCES += $(kml_sources)
+libISSM_a_CXXFLAGS = -fPIC -D_SERIAL_ -D_GNU_SOURCE -fno-omit-frame-pointer -pthread -D_CPP_  $(CXXFLAGS) $(CXXOPTFLAGS) 
+
+if PYTHON
+libISSM_a_CXXFLAGS+=  -DNPY_NO_DEPRECATED_API 
+libISSM_a_SOURCES += $(python_sources)
+endif
+
+if MATLAB
 libISSM_a_SOURCES += $(matlab_sources)
-
-libISSM_a_CXXFLAGS = -fPIC -DMATLAB -D_SERIAL_ -D_GNU_SOURCE -fno-omit-frame-pointer -pthread -D_CPP_ $(CXXFLAGS) $(CXXOPTFLAGS) 
+endif
+
 endif
 #}}}
Index: /issm/trunk-jpl/src/c/modules/TriMeshx/TriMeshx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/TriMeshx/TriMeshx.cpp	(revision 11943)
+++ /issm/trunk-jpl/src/c/modules/TriMeshx/TriMeshx.cpp	(revision 11944)
@@ -20,7 +20,9 @@
 	/*output: */
 	double* index=NULL;
+	Matrix* index_matrix=NULL;
 	double* x=NULL;
 	double* y=NULL;
 	double* segments=NULL;
+	Matrix* segments_matrix=NULL;
 	double* segmentmarkerlist=NULL;
 
@@ -90,4 +92,5 @@
 		 backcounter=counter;
 	}
+
 	
 	/*Build regions: */
@@ -124,7 +127,10 @@
 
 	sprintf(options,"%s%lf","pQzDq30ia",area); /*replace V by Q to quiet down the logging*/
+
   
 	triangulate(options, &in, &out, NULL);
+
 	/*report(&out, 0, 1, 1, 1, 1, 0);*/
+
 
 	/*Allocate index, x and y: */
@@ -151,4 +157,6 @@
 	}
 
+
+
 	/*Associate elements with segments: */
 	AssociateSegmentToElement(&segments,out.numberofsegments,index,out.numberoftriangles);
@@ -159,11 +167,16 @@
 	}
 
-	printf("%i %i %i\n",out.numberoftriangles,out.numberofpoints,out.numberofsegments);
 
 	/*Output : */
-	*pindex=new Matrix(index,out.numberoftriangles,3,1);
+	index_matrix=new Matrix(index,out.numberoftriangles,3,1); 
+	index_matrix->Convert(DENSE_SEQUENTIAL);
+	*pindex=index_matrix;
+	
+	segments_matrix=new Matrix(segments,out.numberofsegments,3,1); segments_matrix->Convert(DENSE_SEQUENTIAL);
+	*psegments=segments_matrix;
+
 	*px=new Vector(x,out.numberofpoints);
 	*py=new Vector(y,out.numberofpoints);
-	*psegments=new Matrix(segments,out.numberofsegments,3,1);
 	*psegmentmarkerlist=new Vector(segmentmarkerlist,out.numberofsegments);
+
 }
Index: /issm/trunk-jpl/src/c/modules/modules.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/modules.h	(revision 11943)
+++ /issm/trunk-jpl/src/c/modules/modules.h	(revision 11944)
@@ -116,4 +116,5 @@
 #include "./ThicknessAbsMisfitx/ThicknessAbsMisfitx.h"
 #include "./ThicknessAbsGradientx/ThicknessAbsGradientx.h"
+#include "./TriMeshx/TriMeshx.h"
 #include "./UpdateVertexPositionsx/UpdateVertexPositionsx.h"
 #include "./UpdateConstraintsx/UpdateConstraintsx.h"
Index: /issm/trunk-jpl/src/py/model/petscversion.py
===================================================================
--- /issm/trunk-jpl/src/py/model/petscversion.py	(revision 11943)
+++ /issm/trunk-jpl/src/py/model/petscversion.py	(revision 11944)
@@ -30,5 +30,5 @@
 		
 		if tline[0:21]=="#define _PETSC_MAJOR_":
-			PETSC_VERSION=int(tline[23])
+			PETSC_VERSION=int(tline[22])
 			break
 		
