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

Dirk Bächle tshortik at gmx.de
Thu Aug 16 03:05:01 EDT 2012


Hi Justin,

my guess is that you'll have to parse the manifest file a second time
directly in your SConstruct. For each .css file you have to tell SCons
how it is built from a .less file:

f = open('manifest','r')
for l in f:
env.Less(target= , source= )
f.close()

(from the top of my head and completely untested).
You might also want to check


http://scons.tigris.org/ds/viewMessage.do?dsForumId=1272&dsMessageId=955448

for reference.

Hope this helps you somehow...there might be a more elegant way, but it
should work as described above.

Best regards,

Dirk

On 15.08.2012 22:43, Justin Tulloss wrote:

> 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

>

>

> _______________________________________________

> Scons-users mailing list

> Scons-users at scons.org

> http://four.pairlist.net/mailman/listinfo/scons-users


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20120816/502725b4/attachment.html>


More information about the Scons-users mailing list