Revision 521, 0.6 kB
(checked in by arnonym, 17 years ago)
|
Move the helpers into their own directory (named "admin") so they don't clutter the base-dir
|
Line | |
---|
1 |
#! /usr/bin/env python |
---|
2 |
|
---|
3 |
# |
---|
4 |
# Taken from http://www.scons.org/wiki/ReplacementBuilder |
---|
5 |
# |
---|
6 |
|
---|
7 |
from string import Template |
---|
8 |
|
---|
9 |
def replace_action(target, source, env): |
---|
10 |
open( str(target[0]), 'w' ).write( Template( open( str(source[0]), 'r' ).read() ).safe_substitute( env ) ) |
---|
11 |
return 0 |
---|
12 |
|
---|
13 |
def replace_string(target, source, env): |
---|
14 |
return "building '%s' from '%s'" % ( str(target[0]), str(source[0]) ) |
---|
15 |
|
---|
16 |
def generate(env, **kw): |
---|
17 |
action = env.Action( replace_action, replace_string ) |
---|
18 |
env['BUILDERS']['ScanReplace'] = env.Builder( action=action, src_suffix='.in', single_source=True ) |
---|
19 |
|
---|
20 |
def exists(env): |
---|
21 |
return 1 |
---|
22 |
|
---|