[Scons-users] Mixing configuration and nodes

Ludovic Courtès ludovic.courtes at inria.fr
Mon Oct 12 09:09:05 EDT 2015


Hi,

William Blevins <wblevins001 at gmail.com> skribis:

> Would it be possible to give us the appropriate code snippets? Otherwise
> generic information gives you generic responses.

Sure.

On one hand, I have SCons nodes to download and unpack the source
tarball of the Eigen library:

--8<---------------cut here---------------start------------->8---
def eigen_commands(env):
  dl = env.Command(filename, 'SConscript', dl_eigen)
  unpacked = env.Command(env.Dir(directory), filename, unpack)
  headers = env.Command(env.Dir(header_directory),
                        directory + os.sep + 'Eigen',
                        copy_directory)
  uheaders = env.Command(env.Dir(unsupported_directory),
                         directory + os.sep + 'unsupported',
                         copy_directory)

  env.Depends(headers, unpacked)
  env.Depends(uheaders, unpacked)
  env.Depends(unpacked, dl)
--8<---------------cut here---------------end--------------->8---

Here ‘dl_eigen’ is a function that downloads the tarball (using urllib),
‘unpack’ is a function that unpacks it in the target directory, and so on.

In the top-level SConstruct file, I have:

--8<---------------cut here---------------start------------->8---
conf = Configure(env)
have_eigen = conf.CheckCXXHeader('Eigen/Core')
env = conf.Finish()

if not have_eigen:
  eigen = eigen_commands(env)
else:
  eigen = None
--8<---------------cut here---------------end--------------->8---

So far, so good.

Now, in a ‘SConscript’ file, I have:

--8<---------------cut here---------------start------------->8---
conf = Configure(env)
have_header = conf.CheckCXXHeader('unsupported/Eigen/LevenbergMarquardt'):
env = conf.Finish()
--8<---------------cut here---------------end--------------->8---

The problem is that this ‘CheckCXXHeader’ is done before we’ve had a
chance to download and unpack Eigen.  So it may return false simply
because the tarball hasn’t been unpacked yet.

What I would like is to specify that this configuration phase depends on
the ‘unpacked’ node above.

Is there a way to achieve that?

Thank you,
Ludo’.


More information about the Scons-users mailing list