Can you explain the logPrint() problem? It is not quite clear. I tried to be careful<div>that Framework was picklable.</div><div><br></div><div>   Matt<br><br><div class="gmail_quote">On Mon, Aug 23, 2010 at 9:37 PM, Jed Brown <span dir="ltr"><<a href="mailto:jed@59a2.org">jed@59a2.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">On Mon, 23 Aug 2010 16:18:27 -0500 (CDT), Satish Balay <<a href="mailto:balay@mcs.anl.gov">balay@mcs.anl.gov</a>> wrote:<br>

> Well currently configure is to be invoked in PETSC_DIR - and the py scripts<br>
> generally use relative paths to find each other. For eg: config/configure.py has:<br>
><br>
>   # Should be run from the toplevel<br>
>   configDir = os.path.abspath('config')<br>
>   bsDir     = os.path.join(configDir, 'BuildSystem')<br>
<br>
Right, and self.petscdir is set regardless of whether the environment<br>
variable PETSC_DIR has been set.  The trouble comes when you invoke a<br>
script (that could be run stand-alone, even if that is advanced usage).<br>
Even if you didn't mind requiring that PWD be chosen carefully before<br>
calling the maintenance script (which I find ugly), we still don't want<br>
to copy all the environment checks and error handling from configure.py,<br>
but we can't find *any* PETSc modules without knowing PETSC_DIR or using<br>
the relative path hacks.<br>
<br>
In this case, the script has to be able to "import script" before the<br>
PETScMaker type can be declared.  Maybe the right thing to do is to move<br>
the whole class definition into cmakeboot.main() which acquires petscdir<br>
as an explicit argument, and can thus set things up correctly.<br>
<br>
Any comments/suggestions on what I currently have in cmakeboot.py?<br>
<br>
  def main(petscdir, petscarch, argDB=None, framework=None, logPrint=printFunction, args=[]):<br>
    # This can be called as a stand-alone program, or by importing it from<br>
    # python.  The latter functionality is needed because argDB does not<br>
    # get written until the very end of configure, but we want to run this<br>
    # automatically during configure (if CMake is available).<br>
    #<br>
    # Strangely, we can't store logPrint in the PETScMaker because<br>
    # (somewhere) it creeps into framework (which I don't want to modify)<br>
    # and makes the result unpickleable.  This is not a problem when run<br>
    # as a standalone program (because the database is read-only), but is<br>
    # not okay when called from configure.<br>
    PETScMaker(petscdir,petscarch,argDB,framework).cmakeboot(args,logPrint)<br>
<br>
Note that cmakeboot.py can be called independently after configure, it<br>
does not modify argDB at all, but I have it running during configure<br>
just so that users of the cmake build don't have any extra steps to<br>
remember (just configure as usual, the run make from the build<br>
directory).<br>
<font color="#888888"><br>
Jed<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener<br>

</div>