[Scons-users] Adding my tools to the site specific directory

Pedro Inácio pedromiragaia at gmail.com
Tue Oct 28 10:24:07 EDT 2014


Hi,

I am trying to add my custom tools to the site specific directories so that
SCons automatically loads them into the default environment.
It does not seem to work for me.
What am I doing wrong?

Here is a minimal example,

$ scons --version
SCons by Steven Knight et al.:
    script: v2.3.0, 2013/03/03 09:48:35, by garyo on reepicheep
    engine: v2.3.0, 2013/03/03 09:48:35, by garyo on reepicheep
    engine path:
['/home/pmginacio/lib/python/scons/scons-local-2.3.0/SCons']
Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
2011, 2012, 2013 The SCons Foundatio

$ cat site_scons/site_tools/my_tool.py
"""SCons.Tool.formations

Tool-specific initialization for my_tool.

There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""

import SCons

def foo(target, source, env):
    print "Hello World"

def generate(env):
    MyTask=SCons.Builder.Builder(action=foo)

    # Add the builders to the Environment
    env['BUILDERS']['MyTask'] = MyTask

def exists(env):
    return 1

If I explicitly request my tool to be loaded it works fine:
$ cat test.succeeds.scons
env=Environment(tools=['my_tool'], toolpath=['site_scons/site_tools'])

nothing=env.Value('')
env.MyTask(target='a',source=nothing)

$ scons -f test.succeeds.scons
scons: Reading SConscript files ...
scons: done reading SConscript files.

scons: warning: Support for pre-2.7.0 Python version (2.6.6) is deprecated.
    If this will cause hardship, contact dev at scons.tigris.org.
File "/home/pmginacio/bin/org/scons", line 192, in <module>
scons: Building targets ...
foo(["a"], [''])
Hello World
scons: done building targets.

However, according to the manual, SCons should automatically load tools
from the site_scons/site_tools directory.
In my case, this is not happening:
$ cat test.fails.scons
env=Environment()

nothing=env.Value('')
env.MyTask(target='a',source=nothing)

$ scons -f test.fails.scons
scons: Reading SConscript files ...
AttributeError: 'SConsEnvironment' object has no attribute 'MyTask':
  File "test.fails.scons", line 10:
    env.MyTask(target='a',source=nothing)

Could someone point out what is going on?

Regards,
Pedro Inacio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20141028/79d06e88/attachment.html>


More information about the Scons-users mailing list