[Scons-users] issue with variant-dir

Stefan Seefeld stefan at seefeld.name
Thu Aug 4 17:55:28 EDT 2016


Hi,

I'm having some issue with the variant_dir variable. I have reduced the
problem to a minimal test case, so let me illustrate the problem with that:


Consider the following directory structure:


./SConstruct

./src/SConscript

        index.html

        style.css

        images/


./build/

./html/


The toplevel SConstruct file contains "env.SConscript('src/SConscript',
variant_dir='build', exports={'env':env})",

and the src/SConscript file contains this chunk of code:


  Import('env')

  def MakeHTML(target, source, resources=[]):

      env.Command(target, source,
                [Mkdir('$TARGET'),
                 Copy('$TARGET/', '$SOURCE')])
      for r in resources:
          env.Depends(target, target + r)
          env.Command(target + r, r, Copy('$TARGET', '$SOURCE'))


  MakeHTML('html/', 'index.html', resources=['style.css', 'images/'])


The intent is simply to copy "index.html" and its dependencies
("style.css" and "images/") from src/ into html/, using "./build" as a
temporary build directory. SCons will start by creating "build/" and
clone "index.html" and "style.css" into it together with the
"SConscript" file. For some reason it does not clone the "images/"
directory. This causes the actual build command (here just a simple
copy) to fail with

  "scons: *** [build/html/images] build/images: No such file or directory"

Note that everything works fine if I don't use a variant directory.


Does anyone know what I'm doing wrong ? (I don't want to list the
individual files in "images/" explicitly in my SConscript file.)


Thanks,

        Stefan

-- 

      ...ich hab' noch einen Koffer in Berlin...



More information about the Scons-users mailing list