Add program and sconscript tools

This commit is contained in:
Eryn Wells 2015-10-17 00:13:49 -07:00
parent bd7a79c9e1
commit e1c4e0c4b7
4 changed files with 87 additions and 8 deletions

View file

@ -0,0 +1,36 @@
# sconscript.py
# Eryn Wells <eryn@erynwells.me>
'''
SCons tool for working with SConscripts.
'''
import SCons.Script
def _do_sconscript(env):
original_sconscript = env.SConscript
def sconscript(env, sconscript, clone=False, *args, **kwargs):
exports = {'Library': env.Library,
'StaticLibrary': env.StaticLibrary,
'SharedLibrary': env.SharedLibrary,
'Program': env.Program}
SCons.Script._SConscript.GlobalDict.update(exports)
env.log('Reading {}'.format(sconscript))
return original_sconscript(sconscript,
{'env': env.Clone() if clone else env},
*args,
**kwargs)
return sconscript
#
# SCons tool interface
#
def generate(env):
env.AddMethod(_do_sconscript(env), 'SConscript')
def exists(env):
return True