Commits

BarryFSmith committed 48b3efb

split mpi4py generation into build phase run when PETSc is built and install phase run when PETSc is installed (or run when PETSc is built if --prefix is not set)

Comments (0)

Files changed (2)

config/PETSc/packages/mpi4py.py

         archflags = "ARCHFLAGS=\'-arch i386\' "
       else:
         archflags = "ARCHFLAGS=\'-arch x86_64\' "
-#
-#  This should be split into one part that is run at make all time and one that is run at make install time
-#  when the prefix requires sudo to install
-    self.addMakeRule('mpi4py','', \
+
+    self.addMakeRule('mpi4pybuild','', \
                        ['@echo "*** Building mpi4py ***"',\
                           '@(MPICC=${PCC} && export MPICC && cd '+self.packageDir+' && \\\n\
            python setup.py clean --all && \\\n\
-           '+archflags+'python setup.py build  && \\\n\
-           '+archflags+self.installSudo+'python setup.py install --install-lib='+os.path.join(self.installDir,'lib')+') > ${PETSC_ARCH}/conf/petsc4py.log 2>&1 || \\\n\
+           '+archflags+'python setup.py build ) > ${PETSC_ARCH}/conf/mpi4py.log 2>&1 || \\\n\
+             (echo "**************************ERROR*************************************" && \\\n\
+             echo "Error building mpi4py. Check ${PETSC_ARCH}/conf/mpi4py.log" && \\\n\
+             echo "********************************************************************" && \\\n\
+             exit 1)'])
+    self.addMakeRule('mpi4pyinstall','', \
+                       ['@echo "*** Installing mpi4py ***"',\
+                          '@(MPICC=${PCC} && export MPICC && cd '+self.packageDir+' && \\\n\
+           python setup.py clean --all && \\\n\
+           '+archflags+'python setup.py install --install-lib='+os.path.join(self.installDir,'lib')+') >> ${PETSC_ARCH}/conf/mpi4py.log 2>&1 || \\\n\
              (echo "**************************ERROR*************************************" && \\\n\
-             echo "Error building mpi4py. Check ${PETSC_ARCH}/conf/petsc4py.log" && \\\n\
+             echo "Error building mpi4py. Check ${PETSC_ARCH}/conf/mpi4py.log" && \\\n\
              echo "********************************************************************" && \\\n\
              exit 1)',\
                           '@echo "====================================="',\
                           '@echo "To use mpi4py, add '+os.path.join(self.petscconfigure.installdir,'lib')+' to PYTHONPATH"',\
                           '@echo "====================================="'])
+    if self.framework.argDB['prefix']:
+      self.addMakeRule('mpi4py-build','mpi4pybuild')
+      self.addMakeRule('mpi4py-install','mpi4pyinstall')
+    else:
+      self.addMakeRule('mpi4py-build','mpi4pybuild mpi4pyinstall')
+      self.addMakeRule('mpi4py-install','')
 
     return self.installDir
 
 all-legacy:
 	@${OMAKE}  PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} PETSC_BUILD_USING_CMAKE="" MAKE_IS_GNUMAKE="" all
 
-all-gnumake-local: chk_makej info gnumake matlabbin mpi4py petsc4py
+all-gnumake-local: chk_makej info gnumake matlabbin mpi4py-build petsc4py
 
-all-cmake-local: chk_makej info cmakegen cmake matlabbin mpi4py petsc4py
+all-cmake-local: chk_makej info cmakegen cmake matlabbin mpi4py-build petsc4py
 
-all-legacy-local: chk_makej chklib_dir info deletelibs deletemods build matlabbin shared_nomesg mpi4py petsc4py
+all-legacy-local: chk_makej chklib_dir info deletelibs deletemods build matlabbin shared_nomesg mpi4py-build petsc4py
 #
 # Prints information about the system and version of PETSc being compiled
 #
 #
 install:
 	@${PYTHON} ./config/install.py -destDir=${DESTDIR}
+	${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} mpi4py-install
 
 newall:
 	-@cd src/sys;  @${PYTHON} ${PETSC_DIR}/config/builder.py