Commits

Satish Balay  committed 548b1fa

configure: save/restore reconfigure.py when --with-clean is used

  • Participants
  • Parent commits e97fc2e

Comments (2)

  1. Satish Balay author

    Yeah - that was what I did in my first iteration [to avoid figuring out a temp file name/location without a potential name conflict]

    But then the code was much longer - and then I had to add additional code to reset the 'execute' bit on the file. At which point I went back to the simpler 'move' primitive.

Files changed (1)

File config/PETSc/utilities/installDir.py

       shutil.rmtree(self.dir)
     return
 
+  def saveReconfigure(self):
+    self.reconfigure_file = os.path.join(self.dir,'conf','reconfigure-'+self.arch.arch+'.py')
+    self.save_reconfigure_file = None
+    if self.framework.argDB['with-clean'] and os.path.exists(self.reconfigure_file):
+      self.save_reconfigure_file = '.save.reconfigure-'+self.arch.arch+'.py'
+      try:
+        if os.path.exists(self.save_reconfigure_file): os.unlink(self.save_reconfigure_file)
+        os.rename(self.reconfigure_file,self.save_reconfigure_file)
+      except Exception, e:
+        self.save_reconfigure_file = None
+        self.framework.logPrint('error in saveReconfigure(): '+ str(e))
+    return
+
+  def restoreReconfigure(self):
+    if self.framework.argDB['with-clean'] and self.save_reconfigure_file:
+      try:
+        os.rename(self.save_reconfigure_file,self.reconfigure_file)
+      except Exception, e:
+        self.framework.logPrint('error in restoreReconfigure(): '+ str(e))
+    return
+
   def configure(self):
     self.executeTest(self.setInstallDir)
+    self.executeTest(self.saveReconfigure)
     self.executeTest(self.cleanInstallDir)
     self.executeTest(self.configureInstallDir)
+    self.executeTest(self.restoreReconfigure)
     return