← Back to team overview

dolfin team mailing list archive

Re: Testing for library version

 

On Sunday 27 September 2009 20:18:07 Garth N. Wells wrote:
> Johan Hake wrote:
> > On Sunday 27 September 2009 19:49:09 Garth N. Wells wrote:
> >> Where's the appropriate place in the build system to test for the
> >> version number of external libraries? Is it in dolfin/SConscript (using
> >>   the simula-scons function 'checkVersion')?
> >
> > I do not think we have any defined sections in SConstruct/SConscript
> > where this should be done. We have used checkVersion to check for the
> > swig version some years ago... It is still there as out-commented code in
> > the SConscript file.
> >
> > I think the function just compare a version string with another handed
> > version string, where the numbers are delimited by '.'.
> >
> > Aren't there any version checks done in the pkg-config generator files?
> 
> No, but I guess that's not the place to do it since they are unrelated
> to DOLFIN and just produce a foo.pc file.
> 
> I guest the right way is to use 'pkg-config --version foo.pc' rather
> than checkVersion. 

Again, checkVersion is just a function that check if a version string is 
larger or equal than a passed version string. So the test might look something 
like this:

  foo_version = getoutput("pkg-config --version foo.pc")
  if scons.checkVersion(foo_version,"3.0.0"):
      raise Error

 
> Still, I don't know where this check is best performed.

Not sure either. I added an extensive check for the SWIG version in 
SConscript. I have never felt good about that piece of code...

With the present state of the build system it is not easy to answer questions 
like this. However it would be nice to add some functionality to the scons.cfg 
file. Instead of passing a list of strings, stating the dependencies we pass a 
dict. 

Something like:

  OptDependencies = {'petsc':'3.0.0',
                     'slepc':'2.3.3':
                     'foo':None,
                      ...}

The checks could then be done in the simula-scons library, when the 
dependencies are checked for.
 
> My motivation for this is to require PETSc >= 3 so the that PETsc
> wrappers can cleaned up.

Yes, I just saw your blueprint :)

Johan


Follow ups

References