1
votes

Part of my build process is to create a tar file of an input directory, located at src/bundle/bundle. In src/bundle/SConscript:

Import('*')

bundleDir = Dir("bundle")
jsontar = Command("bundle.tar", bundleDir,
                  "/home/dbender/bin/mkvgconf $SOURCE $TARGET")

in my SConstruct:

SConscript(Split('src/bundle/SConscript'),
  exports='bin_env lib_env', build_dir='tmp/bundle')

When attempting to build:

scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
/home/dbender/bin/mkvgconf tmp/bundle/bundle tmp/bundle/bundle.tar
Input directory tmp/bundle/bundle not found!
scons: *** [tmp/bundle/bundle.tar] Error 1
scons: building terminated because of errors.

Clearly scons is not copying the src/bundle/bundle to tmp/bundle/bundle, but I am stumped as to why.

Footnotes: Using absolute pathname for mkvgconf is bad practice but just intermediate until I have this problem solved.

1

1 Answers

1
votes

SCons doesn't know anything about the contents of your input src/bundle/bundle - only the program mkvgconf knows what it does with that directory.

One solution is to add an explicit dependency in the SConscript:

import os
Depends('bundle.tar', Glob(str(bundleDir) + os.path.sep + '*'))

That also means that when you update the contents of the bundle directory, the mkvgconf script will be rerun.

PS. you might want to change the build_dir argument name to variant_dir, as the former is deprecated in favor of the latter in recent SCons releases.