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

William Blevins wblevins001 at gmail.com
Fri Oct 31 23:27:26 EDT 2014


Pedro,

The last time I used "site_scons/site_tools" for custom scanner/emitters in
SCons 2.3.0 on RHEL5 under the python 2.4, and it worked as expected.

Going out on a limb here, has someone add "--no-site-dir" to your
SCONSFLAGS?

Other than that, I cannot think of anything ;(

V/R,
William

On Tue, Oct 28, 2014 at 10:24 AM, Pedro Inácio <pedromiragaia at gmail.com>
wrote:

> 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
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20141031/bb04c89c/attachment.html>


More information about the Scons-users mailing list