[Scons-users] Build results of a scanner function?

Justin Tulloss justin at rd.io
Wed Aug 15 16:43:38 EDT 2012


Hello,

This is a newbie question, so hopefully it's straightforward to answer. I'm
using scons to build my web frontend. I have a list of .less files that I
want to compile to .css files. These less files are listed in a manifest
file. I have a scanner that reads the manifest file and returns the files
listed. As I understand it, this makes them implicit dependencies of the
target. How do I indicate that I want my .less builder to run against all
of these source files?

Here's the important bits of code for context:

def build_target(target, source, env):
# unimportant stuff
return None

def scan_target(node, env, path):
js_env = environment.Environment('rdio')
# This actually finds all the less files.
files = js_env.less_app_bundle()
return files

# I want this to find the less files given a .json file (which is the
manifest)
target_scanner = Scanner(
name='LessScan',
function=scan_target,
skeys=['.json'])

target_builder = Builder(
action=build_target,
source_scanner=target_scanner)

less_builder = Builder(
generator=lambda source, target, env, for_signature: \
'%s --include-path=%s -x $SOURCE > $TARGET' % (lessc, web_root),
suffix='.css',
source_scanner=target_scanner)

env = Environment()
env.Append(BUILDERS={
'Target': target_builder,
'Less': less_builder,
})

env.Target(['targets/rdio.json'])

What I want is the results of the scan_target function to be read one by
one into the less_builder function. How would I do something like that?

Thanks a lot for your help!

Justin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20120815/5bc0b34c/attachment.html>


More information about the Scons-users mailing list