[Scons-users] Getting a list of aliases from Scons

Brian Fitzgerald bfitz at blizzard.com
Thu Oct 31 12:14:22 EDT 2013


We use this:

if GetOption('aliases'):
print 'Available Build Aliases:'
print '-----'
aliases = SCons.Node.Alias.default_ans.keys()
aliases.sort()
for x in aliases:
print x

From: scons-users-bounces at scons.org [mailto:scons-users-bounces at scons.org] On Behalf Of Pico Geyer
Sent: Thursday, October 31, 2013 9:10 AM
To: SCons users mailing list
Subject: [Scons-users] Getting a list of aliases from Scons

Hi all.
Is there a way in Scons to get a list of aliases that have been defined in my Sconscript files.
I want to automate my Help() message by listing all aliases.
So for example for example:
env.Alias('foo', foo_program)
env.Alias('bar', bar_program)
Help('You can build the following: {}'.format(' '.join(ALIAS_LIST))
I want the above to help message to say:
You can build the following: foo bar
I eventually came up with the following hack:
def myalias(env, alias, target):
alias_cmd = env['ORIG_ALIAS']
alias_cmd(alias, target)
if 'ALIAS_LIST' not in env:
env['ALIAS_LIST'] = []
env['ALIAS_LIST'].append(alias)

env = Environment()
env['ORIG_ALIAS'] = env.Alias
env.AddMethod(myalias, 'Alias')

Is there a better way to achieve this?

Thanks and regards,
Pico
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://four.pairlist.net/pipermail/scons-users/attachments/20131031/8605a6a0/attachment.htm


More information about the Scons-users mailing list