tags:

views:

132

answers:

1

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  A: 

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.

rq
Thank you rq, you solved my issue in this circumstance! For fun, I was hunting around for recursive globbing solutions and didn't find any generic scons routines. Any ideas on that (I guess it would also have to be smart enough to avoid .svn directories).
codehero
@codehero: It is very awkward to do in SCons, and I could never get it to work right. You always end up Globbing the build dir instead of the source dir, or vice versa. It doesn't walk directories because they only exist in the source hierarchy, etc. If only there was some sort of web site for asking programming related questions, then you could ask about it there and maybe someone would know... ;-)
rq